Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Injector20 #642

Merged
merged 50 commits into from
Nov 15, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
93b777c
move(scope): appease the History God
mhevery Oct 25, 2011
48697a2
refactor(injector): turn scope into a service
mhevery Oct 17, 2011
03dd8c4
feat(injector): Service look up failures include dependency path
mhevery Oct 26, 2011
d9b58f2
move(compiler): appease the History God
mhevery Oct 25, 2011
d12df0d
refactor(compiler) turn compiler into a service
mhevery Oct 26, 2011
411c1ae
feat(injector): support ['$service', function($service){}] annotation…
mhevery Oct 27, 2011
9062996
feat(injector): support $inject(fn($service){}) function invocation
mhevery Oct 27, 2011
4c10d33
refactor(api): cleaned up the externalization of angular API methods
mhevery Nov 1, 2011
c925f8a
new(injector): new injector v2.0
mhevery Oct 31, 2011
ed36b9d
refactor(injector): switch to injector 2.0 introduce modules
mhevery Nov 2, 2011
bd04316
refactor(services): migrate angular.service -> module
mhevery Nov 2, 2011
f684f20
cleanup(parser): removed unused method
mhevery Nov 3, 2011
16597e8
refactor($service): removed almost all references to scope.$service
mhevery Nov 3, 2011
bee6060
move(parser): appease the History God
mhevery Nov 3, 2011
c6d2549
fix(JSON): json date parsing same native/ngular parser
mhevery Nov 3, 2011
7c11531
refactor(parser): turn parser into a service (keep compatibility hack)
mhevery Nov 3, 2011
6022f3d
move(filters): appease the History God
mhevery Nov 3, 2011
cb6f832
refactor(filter): filters are now injectable and services
mhevery Nov 3, 2011
3972d2a
refactor(json): break dependence on api.js
mhevery Nov 4, 2011
dd9151e
refacter(filters): convert filter/limitTo/orderBy from type augmentat…
mhevery Nov 4, 2011
c27aba4
refactor(api): remove type augmentation
mhevery Nov 4, 2011
a87f2fb
refactor(mock): moved mocks into its own module
mhevery Nov 4, 2011
923da41
fix(i18n): updated the way locale is being registered
mhevery Nov 8, 2011
78c7066
refactor(angular): isDate / isArray test iframe independent fix
mhevery Nov 8, 2011
7cb03c5
chore(angular): clean up unused constants
mhevery Nov 8, 2011
4b35a59
refactor(scenario): fix scenario bootstrap & publish injector for ins…
mhevery Nov 8, 2011
085e3c6
new(directive): added ng:module directive for loading modules
mhevery Nov 9, 2011
9c06394
chore(scenario tests): make scenario tests pass again
mhevery Nov 9, 2011
b3c17f3
chore(scope): remove $service
mhevery Nov 9, 2011
c283bf6
refactor($location): merged $locationConfig service into $locationPro…
mhevery Nov 9, 2011
f0fa5e6
doc(AUTO, NG_MOCK): Documenting the AUTO and NG_MOCK module
mhevery Nov 10, 2011
74fac45
doc($filter): added $filter documentation
mhevery Nov 10, 2011
57c37a2
doc(service): update docs for the moved services
mhevery Nov 10, 2011
ea18f45
doc($formFactory): migrated the $formFactory documentation
mhevery Nov 10, 2011
e45b013
doc(locale): migrate docs to new format
mhevery Nov 10, 2011
a8aa193
doc($rootScope): scope documentation changes
mhevery Nov 10, 2011
1cc6bee
docs(browser): moved and migrate browser removed unneeded files.
mhevery Nov 10, 2011
8fe77b6
refactor(docs): improved the visual rendering of the documentation pages
mhevery Nov 10, 2011
5279de0
fix($location): links without path segment should not change the path
vojtajina Nov 10, 2011
f6d98f1
fix(doc): make output less noisy
mhevery Nov 10, 2011
b09595a
fix(doc) cleanup all api doc link warnings
mhevery Nov 11, 2011
186a840
feat(bootstrap): added angular.bootstrap method
mhevery Nov 11, 2011
035c751
fix(doc) cleanup all dev guide doc link warnings
mhevery Nov 11, 2011
acbd7cd
style(docs): make jslint happy - fix some warnings
vojtajina Nov 12, 2011
8d6dc0b
del($eager): removed the support for $eager services
mhevery Nov 12, 2011
e88dfb7
refactor(injector): $injector is no longer a function.
mhevery Nov 12, 2011
ac73e88
add(doc): added missing angular.module.ng namespace
mhevery Nov 14, 2011
94e1a07
doc(rename): NG_LOCALE -> ngLocale
mhevery Nov 14, 2011
9555511
style(angularPublic): move public export definition to AnuglarPublic.js
mhevery Nov 14, 2011
8adae2f
refactor(injector): removed loadModule/ng:module
mhevery Nov 14, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 14 additions & 14 deletions angularFiles.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
angularFiles = {
'angularSrc': [
'src/Angular.js',
'src/AngularPublic.js',
'src/JSON.js',
'src/Compiler.js',
'src/Scope.js',
'src/Injector.js',
'src/parser.js',
'src/Resource.js',
'src/Browser.js',
'src/sanitizer.js',
'src/jqLite.js',
'src/apis.js',
'src/filters.js',
'src/service/browser.js',
'src/service/compiler.js',
'src/service/cookieStore.js',
'src/service/cookies.js',
'src/service/defer.js',
'src/service/document.js',
'src/service/exceptionHandler.js',
'src/service/filter.js',
'src/service/filter/filter.js',
'src/service/filter/filters.js',
'src/service/filter/limitTo.js',
'src/service/filter/orderBy.js',
'src/service/formFactory.js',
'src/service/location.js',
'src/service/log.js',
'src/service/resource.js',
'src/service/parse.js',
'src/service/route.js',
'src/service/routeParams.js',
'src/service/scope.js',
'src/service/sniffer.js',
'src/service/window.js',
'src/service/xhr.bulk.js',
Expand All @@ -35,8 +40,7 @@ angularFiles = {
'src/widgets.js',
'src/widget/form.js',
'src/widget/input.js',
'src/widget/select.js',
'src/AngularPublic.js'
'src/widget/select.js'
],

'angularScenario': [
Expand Down Expand Up @@ -70,21 +74,20 @@ angularFiles = {
'src/jstd-scenario-adapter/*.js',
'src/scenario/*.js',
'src/angular-mocks.js',
'test/mocks.js',
'test/scenario/*.js',
'test/scenario/output/*.js',
'test/jstd-scenario-adapter/*.js',
'test/*.js',
'test/service/*.js',
'test/service/filter/*.js',
'test/widget/*.js',
'example/personalLog/test/*.js'
],

'jstdExclude': [
'test/jquery_alias.js',
'src/angular-bootstrap.js',
'src/scenario/angular-bootstrap.js',
'src/AngularPublic.js'
'src/scenario/angular-bootstrap.js'
],

'jstdScenario': [
Expand Down Expand Up @@ -115,8 +118,7 @@ angularFiles = {

'jstdPerfExclude': [
'src/angular-bootstrap.js',
'src/scenario/angular-bootstrap.js',
'src/AngularPublic.js'
'src/scenario/angular-bootstrap.js'
],

'jstdJquery': [
Expand All @@ -133,7 +135,6 @@ angularFiles = {
'src/jstd-scenario-adapter/*.js',
'src/scenario/*.js',
'src/angular-mocks.js',
'test/mocks.js',
'test/scenario/*.js',
'test/scenario/output/*.js',
'test/jstd-scenario-adapter/*.js',
Expand All @@ -145,7 +146,6 @@ angularFiles = {

'jstdJqueryExclude': [
'src/angular-bootstrap.js',
'src/AngularPublic.js',
'src/scenario/angular-bootstrap.js',
'test/jquery_remove.js'
]
Expand Down
4 changes: 0 additions & 4 deletions css/angular.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
display: none;
}

.ng-format-negative {
color: red;
}

ng\:form {
display: block;
}
5 changes: 5 additions & 0 deletions docs/content/api/angular.module.ng.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ngdoc overview
@name angular.module.ng
@description

The `ng` is an angular module which contains all of the core angular services.
54 changes: 54 additions & 0 deletions docs/content/api/angular.module.ngdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@ngdoc overview
@name angular.module
@description

The angular.module namespace is a global place for registering angular modules. All modules
(angular core or 3rd party) that should be available to an application must be registered in this
namespace.

# Module

A module is a function that is used to register new service providers and configure existing
providers. Once a provider is registered, {@link angular.module.AUTO.$injector $injector} will use
it to ask for a service instance when it is resolving a dependency for the first time.

<pre>
// Declare the module configuration function.
// The function arguments are fully injectable so that the module function
// can create new providers or configure existing ones.
function MyModule($provide, $locationProvider){
// see $provide for more information.
$provide.value('appName', 'MyCoolApp');

// Configure existing providers
$locationProvider.hashPrefix = '!';
};
</pre>

See: {@link angular.module.AUTO.$provide $provide}, {@link angular.module.ng.$locationProvider $locationProvider}.

# Registering Module Function

In your JavaScript file:
<pre>
// Create the angular.module namespace if one does not exist
// This allows the module code to be loaded before angular.js code.
if (!window.angular) window.angular = {};
if (!angular.module) angular.module = {};

angular.module.MyModule = function(){
// add configuration code here.
};
</pre>

Then you can refer to your module like this:

<pre>
var injector = angular.injector('ng', 'MyModule')
</pre>

Or

<pre>
var injector = angular.injector('ng', angular.module.MyModule)
</pre>
25 changes: 0 additions & 25 deletions docs/content/api/angular.service.ngdoc

This file was deleted.

16 changes: 5 additions & 11 deletions docs/content/api/index.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
* {@link angular.widget Widgets} - Angular custom DOM element
* {@link angular.directive Directives} - Angular DOM element attributes
* {@link angular.markup Markup} and {@link angular.attrMarkup Attribute Markup}
* {@link angular.filter Filters} - Angular output filters
* {@link angular.compile angular.compile()} - Template compiler
* {@link angular.module.ng.$filter Filters} - Angular output filters
* {@link angular.module.ng.$compile $compile} - Template compiler

## Angular Scope API

* {@link angular.scope Scope Object} - Angular scope object
* {@link angular.module.ng.$rootScope.Scope Scope Object} - Angular scope object


## Angular Services & Dependency Injection API

* {@link angular.service Angular Services}
* {@link angular.module.ng Angular Services}
* {@link angular.injector angular.injector() }


## Angular Testing API

* {@link angular.mock Testing Mocks API} - Mock objects for testing
* {@link angular.module.ngMock Testing Mocks API} - Mock objects for testing
* {@link guide/dev_guide.e2e-testing Angular Scenario Runner} - Automated scenario testing
documentation

Expand Down Expand Up @@ -63,9 +63,3 @@ documentation

* {@link angular.fromJson angular.fromJson() }
* {@link angular.toJson angular.toJson() }



## Utility methods for JavaScript types
* {@link angular.Object Object API} - Utility functions for JavaScript objects
* {@link angular.Array Array API} - Utility functions for JavaScript arrays
29 changes: 25 additions & 4 deletions docs/content/cookbook/advancedform.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,28 @@ detection, and preventing invalid form submission.
save: function() {
this.master = this.form;
this.cancel();
},

addContact: function() {
this.form.contacts.push({type:'', value:''});
},

removeContact: function(contact) {
for ( var i = 0, ii = this.form.contacts.length; i < ii; i++) {
if (contact === this.form.contacts[i]) {
this.form.contacts.splice(i, 1);
}
}
},

isCancelDisabled: function() {
return angular.equals(this.master, this.form);
},

isSaveDisabled: function() {
return this.myForm.$invalid || angular.equals(this.master, this.form);
}

};
</script>
<div ng:controller="UserForm">
Expand All @@ -53,7 +74,7 @@ detection, and preventing invalid form submission.
ng:pattern="zip" required/><br/><br/>

<label>Contacts:</label>
[ <a href="" ng:click="form.contacts.$add()">add</a> ]
[ <a href="" ng:click="addContact()">add</a> ]
<div ng:repeat="contact in form.contacts">
<select ng:model="contact.type">
<option>email</option>
Expand All @@ -62,10 +83,10 @@ detection, and preventing invalid form submission.
<option>IM</option>
</select>
<input type="text" ng:model="contact.value" required/>
[ <a href="" ng:click="form.contacts.$remove(contact)">X</a> ]
[ <a href="" ng:click="removeContact(contact)">X</a> ]
</div>
<button ng:click="cancel()" ng:disabled="{{master.$equals(form)}}">Cancel</button>
<button ng:click="save()" ng:disabled="{{myForm.$invalid || master.$equals(form)}}">Save</button>
<button ng:click="cancel()" ng:disabled="{{isCancelDisabled()}}">Cancel</button>
<button ng:click="save()" ng:disabled="{{isSaveDisabled()}}">Save</button>
</form>

<hr/>
Expand Down
4 changes: 2 additions & 2 deletions docs/content/cookbook/deeplinking.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ The two partials are defined in the following URLs:
# Things to notice

* Routes are defined in the `AppCntl` class. The initialization of the controller causes the
initialization of the {@link api/angular.service.$route $route} service with the proper URL
initialization of the {@link api/angular.module.ng.$route $route} service with the proper URL
routes.
* The {@link api/angular.service.$route $route} service then watches the URL and instantiates the
* The {@link api/angular.module.ng.$route $route} service then watches the URL and instantiates the
appropriate controller when the URL changes.
* The {@link api/angular.widget.ng:view ng:view} widget loads the view when the URL changes. It
also
Expand Down
18 changes: 15 additions & 3 deletions docs/content/cookbook/form.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ allow a user to enter data.
};
this.state = /^\w\w$/;
this.zip = /^\d\d\d\d\d$/;

this.addContact = function() {
this.user.contacts.push({type:'', value:''});
};

this.removeContact = function(contact) {
for ( var i = 0, ii = this.user.contacts.length; i < ii; i++) {
if (contact === this.user.contacts[i]) {
this.user.contacts.splice(i, 1);
}
}
};
}
</script>
<div ng:controller="FormController" class="example">
Expand All @@ -34,7 +46,7 @@ allow a user to enter data.
ng:pattern="zip" required><br/><br/>

<label>Phone:</label>
[ <a href="" ng:click="user.contacts.$add()">add</a> ]
[ <a href="" ng:click="addContact()">add</a> ]
<div ng:repeat="contact in user.contacts">
<select ng:model="contact.type">
<option>email</option>
Expand All @@ -43,7 +55,7 @@ allow a user to enter data.
<option>IM</option>
</select>
<input type="text" ng:model="contact.value" required/>
[ <a href="" ng:click="user.contacts.$remove(contact)">X</a> ]
[ <a href="" ng:click="removeContact(contact)">X</a> ]
</div>
<hr/>
Debug View:
Expand Down Expand Up @@ -92,7 +104,7 @@ allow a user to enter data.

* The user data model is initialized {@link api/angular.directive.ng:controller controller} and is
available in
the {@link api/angular.scope scope} with the initial data.
the {@link api/angular.module.ng.$rootScope.Scope scope} with the initial data.
* For debugging purposes we have included a debug view of the model to better understand what
is going on.
* The {@link api/angular.widget.input input widgets} simply refer to the model and are data-bound.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/cookbook/helloworld.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Take a look through the source and note:
* The script tag that {@link guide/dev_guide.bootstrap bootstraps} the angular environment.
* The text {@link api/angular.widget.input input widget} which is bound to the greeting name text.
* No need for listener registration and event firing on change events.
* The implicit presence of the `name` variable which is in the root {@link api/angular.scope scope}.
* The implicit presence of the `name` variable which is in the root {@link api/angular.module.ng.$rootScope.Scope scope}.
* The double curly brace `{{markup}}`, which binds the name variable to the greeting text.
* The concept of {@link guide/dev_guide.templates.databinding data binding}, which reflects any
changes to the
Expand Down
2 changes: 1 addition & 1 deletion docs/content/cookbook/index.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ allowing you to send links to specific screens in your app.

# Services

{@link api/angular.service Services}: Services are long lived objects in your applications that are
{@link api/angular.module.ng Services}: Services are long lived objects in your applications that are
available across controllers. A collection of useful services are pre-bundled with angular but you
will likely add your own. Services are initialized using dependency injection, which resolves the
order of initialization. This safeguards you from the perils of global state (a common way to
Expand Down
2 changes: 1 addition & 1 deletion docs/content/cookbook/mvc.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ board variable.
* The view can call any controller function.
* In this example, the `setUrl()` and `readUrl()` functions copy the game state to/from the URL's
hash so the browser's back button will undo game steps. See deep-linking. This example calls {@link
api/angular.scope.$watch $watch()} to set up a listener that invokes `readUrl()` when needed.
api/angular.module.ng.$rootScope.Scope#$watch $watch()} to set up a listener that invokes `readUrl()` when needed.
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ APIs are bound to fields of this global object.

## Related API

{@link api/angular.compile Compiler API}
{@link api/angular.module.ng.$compile Compiler API}
6 changes: 3 additions & 3 deletions docs/content/guide/dev_guide.bootstrap.manual_bootstrap.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ explicitly.
<script src="http://code.angularjs.org/angular.js"></script>
<script>
angular.element(document).ready(function() {
angular.compile(document)().$apply();
angular.bootstrap(document);
});
</script>
</head>
Expand All @@ -31,7 +31,7 @@ This is the sequence that your code should follow if you bootstrap angular on yo

1. After the page is loaded, find the root of the HTML template, which is typically the root of
the document.
2. Run angular's {@link dev_guide.compiler Angular HTML compiler}, which converts a template into
2. Call {@link api/angular.bootstrap} to {@link dev_guide.compiler compile} the template into
an executable, bi-directionally bound application.


Expand All @@ -43,4 +43,4 @@ an executable, bi-directionally bound application.

## Related API

{@link api/angular.compile Compiler API}
{@link api/angular.module.ng.$compile Compiler API}
Loading