mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 15:24:43 +00:00
docs(typos): fix typos in dev guide
This commit is contained in:
parent
8bb3942453
commit
b7d5fa1cbe
11 changed files with 30 additions and 19 deletions
14
.gitattributes
vendored
Normal file
14
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
|
|
@ -25,7 +25,7 @@ initialization.
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
* Place the `script` tag at the buttom of the page. Placing script tags at the end of the page
|
* Place the `script` tag at the buttom of the page. Placing script tags at the end of the page
|
||||||
improves app load time becouse the HTML loading is not blocked by loading of the `angular.js`
|
improves app load time because the HTML loading is not blocked by loading of the `angular.js`
|
||||||
script. You can get the latest bits from {@link http://code.angularjs.org}. Please don't link
|
script. You can get the latest bits from {@link http://code.angularjs.org}. Please don't link
|
||||||
your production code to this URL, as it will expose a security hole on your site. For
|
your production code to this URL, as it will expose a security hole on your site. For
|
||||||
experimental development linking to our site is fine.
|
experimental development linking to our site is fine.
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ describe('state', function() {
|
||||||
var mainCtrl = $controller(MainCtrl, {$scope: mainScope});
|
var mainCtrl = $controller(MainCtrl, {$scope: mainScope});
|
||||||
childScope = mainScope.$new();
|
childScope = mainScope.$new();
|
||||||
var childCtrl = $controller(ChildCtrl, {$scope: childScope});
|
var childCtrl = $controller(ChildCtrl, {$scope: childScope});
|
||||||
babyScope = $rootScope.$new();
|
babyScope = childCtrl.$new();
|
||||||
var babyCtrl = $controller(BabyCtrl, {$scope: babyScope});
|
var babyCtrl = $controller(BabyCtrl, {$scope: babyScope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
@name Developer Guide: Angular Services: Creating Services
|
@name Developer Guide: Angular Services: Creating Services
|
||||||
@description
|
@description
|
||||||
|
|
||||||
While angular offers several useful services, for any nontrivial application you'll find it useful
|
While Angular offers several useful services, for any nontrivial application you'll find it useful
|
||||||
to write your own custom services. To do this you begin by registering a service factory function
|
to write your own custom services. To do this you begin by registering a service factory function
|
||||||
with a module either via the {@link api/angular.module Module#factory api} or directly
|
with a module either via the {@link api/angular.module Module#factory api} or directly
|
||||||
via the {@link api/AUTO.$provide $provide} api inside of module config function.
|
via the {@link api/AUTO.$provide $provide} api inside of module config function.
|
||||||
|
|
||||||
All angular services participate in {@link di dependency injection (DI)} by registering
|
All Angular services participate in {@link di dependency injection (DI)} by registering
|
||||||
themselves with Angular's DI system (injector) under a `name` (id) as well as by declaring
|
themselves with Angular's DI system (injector) under a `name` (id) as well as by declaring
|
||||||
dependencies which need to be provided for the factory function of the registered service. The
|
dependencies which need to be provided for the factory function of the registered service. The
|
||||||
ability to swap dependencies for mocks/stubs/dummies in tests allows for services to be highly
|
ability to swap dependencies for mocks/stubs/dummies in tests allows for services to be highly
|
||||||
|
|
@ -76,17 +76,17 @@ angular.module('myModule', [], function($provide) {
|
||||||
|
|
||||||
# Instantiating Angular Services
|
# Instantiating Angular Services
|
||||||
|
|
||||||
All services in Angular are instantiates services lazily, this means that a service will be created
|
All services in Angular are instantiated lazily. This means that a service will be created
|
||||||
only when it is needed for instantiation of a service or an application component that depends on it.
|
only when it is needed for instantiation of a service or an application component that depends on it.
|
||||||
In other words, angular won't instantiate lazy services unless they are requested directly or
|
In other words, Angular won't instantiate lazy services unless they are requested directly or
|
||||||
indirectly by the application.
|
indirectly by the application.
|
||||||
|
|
||||||
|
|
||||||
# Services as singletons
|
# Services as singletons
|
||||||
|
|
||||||
Lastly, it is important to realize that all angular services are application singletons. This means
|
Lastly, it is important to realize that all Angular services are application singletons. This means
|
||||||
that there is only one instance of a given service per injector. Since angular is lethally allergic
|
that there is only one instance of a given service per injector. Since Angular is lethally allergic
|
||||||
to the global state, it is possible to create multiple injectors, each with its own instance of a
|
to global state, it is possible to create multiple injectors, each with its own instance of a
|
||||||
given service, but that is rarely needed, except in tests where this property is crucially
|
given service, but that is rarely needed, except in tests where this property is crucially
|
||||||
important.
|
important.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
@name Developer Guide: Angular Services: Testing Angular Services
|
@name Developer Guide: Angular Services: Testing Angular Services
|
||||||
@description
|
@description
|
||||||
|
|
||||||
Following is a unit test for the service in the example in {@link
|
The following is a unit test for the 'notify' service in the 'Dependencies' example in {@link
|
||||||
dev_guide.services.creating_services Creating Angular Services}. The unit test example uses Jasmine
|
dev_guide.services.creating_services Creating Angular Services}. The unit test example uses Jasmine
|
||||||
spy (mock) instead of a real browser alert.
|
spy (mock) instead of a real browser alert.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Angular sets these CSS classes. It is up to your application to provide useful s
|
||||||
|
|
||||||
* `ng-invalid`, `ng-valid`
|
* `ng-invalid`, `ng-valid`
|
||||||
- **Usage:** angular applies this class to an input widget element if that element's input does
|
- **Usage:** angular applies this class to an input widget element if that element's input does
|
||||||
notpass validation. (see {@link api/ng.directive:input input} directive).
|
not pass validation. (see {@link api/ng.directive:input input} directive).
|
||||||
|
|
||||||
* `ng-pristine`, `ng-dirty`
|
* `ng-pristine`, `ng-dirty`
|
||||||
- **Usage:** angular {@link api/ng.directive:input input} directive applies `ng-pristine` class
|
- **Usage:** angular {@link api/ng.directive:input input} directive applies `ng-pristine` class
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,6 @@ displaying it to the user. You can pass expressions through a chain of filters l
|
||||||
The expression evaluator simply passes the value of name to
|
The expression evaluator simply passes the value of name to
|
||||||
{@link api/ng.filter:uppercase uppercase filter}.
|
{@link api/ng.filter:uppercase uppercase filter}.
|
||||||
|
|
||||||
In addition to formatting data, filters can also modify the DOM. This allows filters to handle
|
|
||||||
tasks such as conditionally applying CSS styles to filtered output.
|
|
||||||
|
|
||||||
|
|
||||||
## Related Topics
|
## Related Topics
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ For example:
|
||||||
});
|
});
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
Results in code bloat do to the need of temporary variable:
|
Results in code bloat due to the need of temporary variable:
|
||||||
<pre>
|
<pre>
|
||||||
var greeterFactory = function(renamed$window) {
|
var greeterFactory = function(renamed$window) {
|
||||||
...;
|
...;
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ The following example shows how to add two-way data-binding to contentEditable e
|
||||||
});
|
});
|
||||||
|
|
||||||
// model -> view
|
// model -> view
|
||||||
ctrl.render = function(value) {
|
ctrl.$render = function(value) {
|
||||||
elm.html(value);
|
elm.html(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,6 @@ Angular frees you from the following pain:
|
||||||
|
|
||||||
# Watch a Presentation About Angular
|
# Watch a Presentation About Angular
|
||||||
|
|
||||||
Here is a presentation on angular from May 2012.
|
Here is a presentation on Angular from May 2012.
|
||||||
|
|
||||||
<iframe width="560" height="315" src="http://www.youtube.com/embed/bfrn5VNpwsg" frameborder="0" allowfullscreen></iframe>
|
<iframe width="560" height="315" src="http://www.youtube.com/embed/bfrn5VNpwsg" frameborder="0" allowfullscreen></iframe>
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ The normal flow of browser receiving an event is that it executes a correspondin
|
||||||
callback. Once the callback completes the browser re-renders the DOM and returns to waiting for
|
callback. Once the callback completes the browser re-renders the DOM and returns to waiting for
|
||||||
more events.
|
more events.
|
||||||
|
|
||||||
When the browser calls into JavaScript the code executes outside they Angular execution context,
|
When the browser calls into JavaScript the code executes outside the Angular execution context,
|
||||||
which means that Angular is unaware of model modifications. To properly process model
|
which means that Angular is unaware of model modifications. To properly process model
|
||||||
modifications the execution has to enter the Angular execution context using the {@link
|
modifications the execution has to enter the Angular execution context using the {@link
|
||||||
api/ng.$rootScope.Scope#$apply `$apply`} method. Only model modifications which
|
api/ng.$rootScope.Scope#$apply `$apply`} method. Only model modifications which
|
||||||
|
|
@ -256,7 +256,7 @@ the `$digest` phase. This delay is desirable, since it coalesces multiple model
|
||||||
3. **Model mutation**
|
3. **Model mutation**
|
||||||
|
|
||||||
For mutations to be properly observed, you should make them only within the {@link
|
For mutations to be properly observed, you should make them only within the {@link
|
||||||
api/ng.$rootScope.Scope#$apply scope.$apply()}. (Angular apis do this
|
api/ng.$rootScope.Scope#$apply scope.$apply()}. (Angular APIs do this
|
||||||
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers,
|
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers,
|
||||||
or asynchronous work with {@link api/ng.$http $http} or {@link
|
or asynchronous work with {@link api/ng.$http $http} or {@link
|
||||||
api/ng.$timeout $timeout} services.
|
api/ng.$timeout $timeout} services.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue