mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
docs(links): corrected borken links
This commit is contained in:
parent
ce4b630524
commit
8b8fdddc0b
26 changed files with 127 additions and 138 deletions
38
CHANGELOG.md
38
CHANGELOG.md
|
|
@ -985,7 +985,7 @@ behavior and migrate your controllers one at a time: <https://gist.github.com/16
|
|||
# <angular/> 0.9.10 flea-whisperer (2011-01-26) #
|
||||
|
||||
### Features
|
||||
- new [`ng:view`](http://docs.angularjs.org/#!/api/angular.widget.ng:view) widget to simplify integration
|
||||
- new [`ng:view`](http://docs.angularjs.org/#!/api/angular.widget.ng-view) widget to simplify integration
|
||||
with the `$route` service
|
||||
- the content of all standard HTML widgets is now being processed
|
||||
(e.g. `<button>{{foo}}</button>` works now) (commit 1d7b9d56)
|
||||
|
|
@ -1306,20 +1306,20 @@ with the `$route` service
|
|||
[element]: http://docs.angularjs.org/#!/api/angular.element
|
||||
[widget]: http://docs.angularjs.org/#!/api/angular.widget
|
||||
[ng:repeat]: http://docs.angularjs.org/#!/api/angular.widget.@ng:repeat
|
||||
[ng:view]: http://docs.angularjs.org/#!/api/angular.widget.ng:view
|
||||
[ng:include]: http://docs.angularjs.org/#!/api/angular.widget.ng:include
|
||||
[ng:options]: http://docs.angularjs.org/#!/api/angular.directive.ng:options
|
||||
[ng:disabled]: http://docs.angularjs.org/#!/api/angular.directive.ng:disabled
|
||||
[ng:selected]: http://docs.angularjs.org/#!/api/angular.directive.ng:selected
|
||||
[ng:checked]: http://docs.angularjs.org/#!/api/angular.directive.ng:checked
|
||||
[ng:multiple]: http://docs.angularjs.org/#!/api/angular.directive.ng:multiple
|
||||
[ng:readonly]: http://docs.angularjs.org/#!/api/angular.directive.ng:readonly
|
||||
[ng:show]: http://docs.angularjs.org/#!/api/angular.directive.ng:show
|
||||
[ng:hide]: http://docs.angularjs.org/#!/api/angular.directive.ng:hide
|
||||
[ng:class]: http://docs.angularjs.org/#!/api/angular.directive.ng:class
|
||||
[ng:src]: http://docs.angularjs.org/#!/api/angular.directive.ng:src
|
||||
[ng:href]: http://docs.angularjs.org/#!/api/angular.directive.ng:href
|
||||
[ng:style]: http://docs.angularjs.org/#!/api/angular.directive.ng:style
|
||||
[ng:view]: http://docs.angularjs.org/#!/api/angular.widget.ng-view
|
||||
[ng:include]: http://docs.angularjs.org/#!/api/angular.widget.ng-include
|
||||
[ng:options]: http://docs.angularjs.org/#!/api/angular.directive.ng-options
|
||||
[ng:disabled]: http://docs.angularjs.org/#!/api/angular.directive.ng-disabled
|
||||
[ng:selected]: http://docs.angularjs.org/#!/api/angular.directive.ng-selected
|
||||
[ng:checked]: http://docs.angularjs.org/#!/api/angular.directive.ng-checked
|
||||
[ng:multiple]: http://docs.angularjs.org/#!/api/angular.directive.ng-multiple
|
||||
[ng:readonly]: http://docs.angularjs.org/#!/api/angular.directive.ng-readonly
|
||||
[ng:show]: http://docs.angularjs.org/#!/api/angular.directive.ng-show
|
||||
[ng:hide]: http://docs.angularjs.org/#!/api/angular.directive.ng-hide
|
||||
[ng:class]: http://docs.angularjs.org/#!/api/angular.directive.ng-class
|
||||
[ng:src]: http://docs.angularjs.org/#!/api/angular.directive.ng-src
|
||||
[ng:href]: http://docs.angularjs.org/#!/api/angular.directive.ng-href
|
||||
[ng:style]: http://docs.angularjs.org/#!/api/angular.directive.ng-style
|
||||
[$defer]: http://docs.angularjs.org/#!/api/angular.module.ng.$defer
|
||||
[$cookies]: http://docs.angularjs.org/#!/api/angular.module.ng.$cookies
|
||||
[$xhr]: http://docs.angularjs.org/#!/api/angular.module.ng.$xhr
|
||||
|
|
@ -1331,7 +1331,7 @@ with the `$route` service
|
|||
[number]: http://docs.angularjs.org/#!/api/angular.filter.number
|
||||
[currency]: http://docs.angularjs.org/#!/api/angular.filter.currency
|
||||
[directive]: http://docs.angularjs.org/#!/api/angular.directive
|
||||
[ng:autobind]: http://docs.angularjs.org/#!/api/angular.directive.ng:autobind
|
||||
[ng:autobind]: http://docs.angularjs.org/#!/api/angular.directive.ng-autobind
|
||||
[guide.di]: http://docs.angularjs.org/#!/guide/dev_guide.di
|
||||
[downloading]: http://docs.angularjs.org/#!/misc/downloading
|
||||
[contribute]: http://docs.angularjs.org/#!/misc/contribute
|
||||
|
|
@ -1339,9 +1339,9 @@ with the `$route` service
|
|||
[angular.version]: http://docs.angularjs.org/#!/api/angular.version
|
||||
[Jstd Scenario Adapter]: https://github.com/angular/angular.js/blob/master/src/jstd-scenario-adapter/Adapter.js
|
||||
[i18n]: http://docs-next.angularjs.org/#!/guide/dev_guide.i18n
|
||||
[ng:pluralize]: http://docs-next.angularjs.org/#!/api/angular.widget.ng:pluralize
|
||||
[ng:pluralize]: http://docs-next.angularjs.org/#!/api/angular.widget.ng-pluralize
|
||||
[ng:form]: http://docs-next.angularjs.org/api/angular.widget.form
|
||||
[ng:cloak]: http://docs-next.angularjs.org/#!/api/angular.directive.ng:cloak
|
||||
[ng:cloak]: http://docs-next.angularjs.org/#!/api/angular.directive.ng-cloak
|
||||
[$on]: http://docs-next.angularjs.org/#!/api/angular.scope.$on
|
||||
[$emit]: http://docs-next.angularjs.org/#!/api/angular.scope.$emit
|
||||
[$broadcast]: http://docs-next.angularjs.org/#!/api/angular.scope.$broadcast
|
||||
|
|
@ -1359,7 +1359,7 @@ with the `$route` service
|
|||
[$cacheFactory]: http://docs-next.angularjs.org/api/angular.module.ng.$cacheFactory
|
||||
[bootstrapping]: http://docs-next.angularjs.org/guide/dev_guide.bootstrap
|
||||
[angular.copy]: http://docs-next.angularjs.org/api/angular.copy
|
||||
[ng:app]: http://docs-next.angularjs.org/api/angular.directive.ng:app
|
||||
[ng:app]: http://docs-next.angularjs.org/api/angular.directive.ng-app
|
||||
[$compile]: http://docs-next.angularjs.org/api/angular.module.ng.$compile
|
||||
[$filterProvider]: http://docs-next.angularjs.org/api/angular.module.ng.$filterProvider
|
||||
[angular.Module]: http://docs-next.angularjs.org/api/angular.Module
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
@description
|
||||
|
||||
Angular initializes automatically when you load the angular script into your page that contains an element
|
||||
with `ng:app` directive:
|
||||
with `ng-app` directive:
|
||||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html ng:app>
|
||||
<html ng-app>
|
||||
<head>
|
||||
<script src="angular.js"></script>
|
||||
</head>
|
||||
|
|
@ -22,16 +22,16 @@ From a high-level view, this is what happens during angular's automatic initiali
|
|||
1. The browser loads the page, and then runs the angular script. Angular waits for the
|
||||
`DOMContentLoaded` (or 'Load') event to attempt to bootstrap.
|
||||
|
||||
2. Angular looks for the `ng:app` directive. If found it then proceeds to compile the DOM element and its children.
|
||||
Optionally the `ng:app` may specify a {@link api/angular.module module} to load before the compilation. For details on
|
||||
2. Angular looks for the `ng-app` directive. If found it then proceeds to compile the DOM element and its children.
|
||||
Optionally the `ng-app` may specify a {@link api/angular.module module} to load before the compilation. For details on
|
||||
how the compiler works, see {@link dev_guide.compiler Angular HTML Compiler}.
|
||||
|
||||
|
||||
## Initialization Options
|
||||
|
||||
The reason why `ng:app` exists is because angular should not assume that the entire HTML
|
||||
The reason why `ng-app` exists is because angular should not assume that the entire HTML
|
||||
document should be processed just because the `angular.js` script is included. In order to compile
|
||||
only a part of the document set the `ng:app` on the root element of this portion.
|
||||
only a part of the document set the `ng-app` on the root element of this portion.
|
||||
|
||||
## Global Angular Object
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ angular, but advanced users who want more control over the initialization proces
|
|||
the manual bootstrapping method instead.
|
||||
|
||||
The best way to get started with manual bootstrapping is to look at the what happens when you use
|
||||
{@link api/angular.module.ng.$compileProvider.directive.ng:app ng:app}, by showing each step of the process
|
||||
{@link api/angular.module.ng.$compileProvider.directive.ng-app ng-app}, by showing each step of the process
|
||||
explicitly.
|
||||
|
||||
<pre>
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ angular should process and manage the page. To initialize angular you do the fol
|
|||
|
||||
* Specify the angular namespace in the `<html>` page
|
||||
* Choose which flavor of angular script to load (debug or production)
|
||||
* Specify whether or not angular should process and manage the page automatically (`ng:app`)
|
||||
* Specify whether or not angular should process and manage the page automatically (`ng-app`)
|
||||
|
||||
The simplest way to initialize angular is to load the angular script and tell angular to compile
|
||||
and manage the whole page. You do this as follows:
|
||||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html xmlns:ng="http://angularjs.org" ng:app>
|
||||
<html ng-app>
|
||||
<head>
|
||||
...
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ directives}
|
|||
## Related Topics
|
||||
|
||||
* {@link dev_guide.compiler Angular HTML Compiler}
|
||||
* {@link dev_guide.compiler.extending_compiler Extending the Angular Compiler}
|
||||
* {@link dev_guide.compiler.testing_dom_element Testing a New DOM Element}
|
||||
|
||||
## Related API
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ In the illustration above, the dependency injection sequence proceeds as follows
|
|||
|
||||
1. Module "phonecat" is created and all the service providers are registered with this module.
|
||||
(the "ng" module is created by Angular behind the scenes as well)
|
||||
2. `ng:app` triggers bootstrap sequence on given element, during which angular creates injector,
|
||||
2. `ng-app` triggers bootstrap sequence on given element, during which angular creates injector,
|
||||
loads "phonecat" and "ng" modules and compiles the template.
|
||||
3. The `ng:controller` directive implicitly creates a new child scope and instantiates
|
||||
3. The `ng-controller` directive implicitly creates a new child scope and instantiates
|
||||
`PhoneListCtrl` controller.
|
||||
4. Injector identifies the `$http` service as `PhoneListCtrl` controller's only dependency.
|
||||
5. Injector checks its instances cache whether the `$http` service has already been instantiated.
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ controller from the HTML template, as follows:
|
|||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html xmlns:ng="http://angularjs.org" ng:controller="MyController" ng:app>
|
||||
<html xmlns:ng="http://angularjs.org" ng-controller="MyController" ng-app>
|
||||
<script src="http://code.angularjs.org/angular.min.js"></script>
|
||||
<body>
|
||||
...
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ You can try evaluating different expressions here:
|
|||
};
|
||||
}
|
||||
</script>
|
||||
<div ng:controller="Cntl2" class="expressions">
|
||||
<div ng-controller="Cntl2" class="expressions">
|
||||
Expression:
|
||||
<input type='text' ng:model="expr" size="80"/>
|
||||
<button ng:click="addExp(expr)">Evaluate</button>
|
||||
<input type='text' ng-model="expr" size="80"/>
|
||||
<button ng-click="addExp(expr)">Evaluate</button>
|
||||
<ul>
|
||||
<li ng:repeat="expr in exprs">
|
||||
[ <a href="" ng:click="removeExp($index)">X</a> ]
|
||||
<tt>{{expr}}</tt> => <span ng:bind="$parent.$eval(expr)"></span>
|
||||
<li ng-repeat="expr in exprs">
|
||||
[ <a href="" ng-click="removeExp($index)">X</a> ]
|
||||
<tt>{{expr}}</tt> => <span ng-bind="$parent.$eval(expr)"></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -105,9 +105,9 @@ the global state (a common source of subtle bugs).
|
|||
}
|
||||
}
|
||||
</script>
|
||||
<div class="example2" ng:controller="Cntl1">
|
||||
Name: <input ng:model="name" type="text"/>
|
||||
<button ng:click="greet()">Greet</button>
|
||||
<div class="example2" ng-controller="Cntl1">
|
||||
Name: <input ng-model="name" type="text"/>
|
||||
<button ng-click="greet()">Greet</button>
|
||||
</div>
|
||||
</doc:source>
|
||||
<doc:scenario>
|
||||
|
|
@ -173,19 +173,19 @@ Extensions: You can further extend the expression vocabulary by adding new metho
|
|||
|
||||
<doc:example>
|
||||
<doc:source>
|
||||
<div ng:init="friends = [
|
||||
<div ng-init="friends = [
|
||||
{name:'John', phone:'555-1212'},
|
||||
{name:'Mary', phone:'555-9876'},
|
||||
{name:'Mike', phone:'555-4321'},
|
||||
{name:'Adam', phone:'555-5678'},
|
||||
{name:'Julie', phone:'555-8765'}]"></div>
|
||||
Search: <input ng:model="searchText"/>
|
||||
Search: <input ng-model="searchText"/>
|
||||
<table class="example3">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Phone</th><tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng:repeat="friend in friends | filter:searchText">
|
||||
<tr ng-repeat="friend in friends | filter:searchText">
|
||||
<td>{{friend.name}}</td>
|
||||
<td>{{friend.phone}}</td>
|
||||
</tr>
|
||||
|
|
@ -236,11 +236,6 @@ objects with additional behavior. By prefixing its additions with $ we are reser
|
|||
so that angular developers and developers who use angular can develop in harmony without collisions.
|
||||
|
||||
|
||||
## Related Topics
|
||||
|
||||
* {@link dev_guide.compiler.markup Understanding Angular Markup}
|
||||
* {@link dev_guide.templates.filters Understanding Angular Filters}
|
||||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.ng.$compile Angular Compiler API}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ http://docs.angularjs.org/#!/api/angular.module.ng.$filter.number number} and {@
|
|||
http://docs.angularjs.org/#!/api/angular.module.ng.$filter.currency currency} filters.
|
||||
|
||||
Additionally, Angular supports localizable pluralization support provided by the {@link
|
||||
api/angular.module.ng.$compileProvider.directive.ng:pluralize ng:pluralize widget}.
|
||||
api/angular.module.ng.$compileProvider.directive.ng-pluralize ng-pluralize widget}.
|
||||
|
||||
All localizable Angular components depend on locale-specific rule sets managed by the {@link
|
||||
api/angular.module.ng.$locale $locale service}.
|
||||
|
|
@ -67,7 +67,7 @@ You can also include the locale specific js file in the index.html page. For exa
|
|||
requires German locale, you would serve index_de-ge.html which will look something like this:
|
||||
|
||||
<pre>
|
||||
<html ng:app>
|
||||
<html ng-app>
|
||||
<head>
|
||||
….
|
||||
<script src="angular.js"></script>
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ template/view. This behavior interacts with and modifies the application model.
|
|||
As discussed in the {@link dev_guide.mvc.understanding_model Model} section of this guide, any
|
||||
objects (or primitives) assigned to the scope become model properties. Any functions assigned to
|
||||
the scope, along with any prototype methods of the controller type, become functions available in
|
||||
the template/view, and can be invoked via angular expressions and `ng:` event handlers (e.g. {@link
|
||||
api/angular.module.ng.$compileProvider.directive.ng:click ng:click}). These controller methods are always evaluated within the
|
||||
the template/view, and can be invoked via angular expressions and `ng-` event handlers (e.g. {@link
|
||||
api/angular.module.ng.$compileProvider.directive.ng-click ng-click}). These controller methods are always evaluated within the
|
||||
context of the angular scope object that the controller function was applied to (which means that
|
||||
the `this` keyword of any controller method is always bound to the scope that the controller
|
||||
augments). This is how the second task of adding behavior to the scope is accomplished.
|
||||
|
|
@ -65,8 +65,8 @@ Do not use controllers for:
|
|||
manipulation—the presentation logic of an application—is well known for being hard to test.
|
||||
Putting any presentation logic into controllers significantly affects testability of the business
|
||||
logic. Angular offers {@link dev_guide.templates.databinding} for automatic DOM manipulation. If
|
||||
you have to perform your own manual DOM manipulation, encapsulate the presentation logic in {@link
|
||||
dev_guide.compiler.widgets widgets} and {@link dev_guide.compiler.directives directives}.
|
||||
you have to perform your own manual DOM manipulation, encapsulate the presentation logic in and
|
||||
{@link api/angular.module.ng.$compileProvider.directive directives}.
|
||||
- Input formatting — Use {@link dev_guide.forms angular form widgets} instead.
|
||||
- Output filtering — Use {@link dev_guide.templates.filters angular filters} instead.
|
||||
- Run stateless or stateful code shared across controllers — Use {@link dev_guide.services angular
|
||||
|
|
@ -78,7 +78,7 @@ instances).
|
|||
# Associating Controllers with Angular Scope Objects
|
||||
|
||||
You can associate controllers with scope objects explicitly via the {@link api/angular.module.ng.$rootScope.Scope#$new
|
||||
scope.$new} api or implicitly via the {@link api/angular.module.ng.$compileProvider.directive.ng:controller ng:controller
|
||||
scope.$new} api or implicitly via the {@link api/angular.module.ng.$compileProvider.directive.ng-controller ng-controller
|
||||
directive} or {@link api/angular.module.ng.$route $route service}.
|
||||
|
||||
|
||||
|
|
@ -99,9 +99,9 @@ string "very". Depending on which button is clicked, the `spice` model is set to
|
|||
## A Spicy Controller Example
|
||||
|
||||
<pre>
|
||||
<body ng:controller="SpicyCtrl">
|
||||
<button ng:click="chiliSpicy()">Chili</button>
|
||||
<button ng:click="jalapenoSpicy()">Jalapeño</button>
|
||||
<body ng-controller="SpicyCtrl">
|
||||
<button ng-click="chiliSpicy()">Chili</button>
|
||||
<button ng-click="jalapenoSpicy()">Jalapeño</button>
|
||||
<p>The food is {{spice}} spicy!</p>
|
||||
</body>
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ SpicyCtrl.prototype.jalapenoSpicy = function() {
|
|||
|
||||
Things to notice in the example above:
|
||||
|
||||
- The `ng:controller` directive is used to (implicitly) create a scope for our template, and the
|
||||
- The `ng-controller` directive is used to (implicitly) create a scope for our template, and the
|
||||
scope is augmented (managed) by the `SpicyCtrl` controller.
|
||||
- `SpicyCtrl` is just a plain JavaScript function. As an (optional) naming convention the name
|
||||
starts with capital letter and ends with "Ctrl" or "Controller".
|
||||
|
|
@ -137,10 +137,10 @@ previous example.
|
|||
## Controller Method Arguments Example
|
||||
|
||||
<pre>
|
||||
<body ng:controller="SpicyCtrl">
|
||||
<input ng:model="customSpice" value="wasabi">
|
||||
<button ng:click="spicy('chili')">Chili</button>
|
||||
<button ng:click="spicy(customSpice)">Custom spice</button>
|
||||
<body ng-controller="SpicyCtrl">
|
||||
<input ng-model="customSpice" value="wasabi">
|
||||
<button ng-click="spicy('chili')">Chili</button>
|
||||
<button ng-click="spicy(customSpice)">Custom spice</button>
|
||||
<p>The food is {{spice}} spicy!</p>
|
||||
</body>
|
||||
|
||||
|
|
@ -164,11 +164,11 @@ Controller inheritance in angular is based on {@link api/angular.module.ng.$root
|
|||
have a look at an example:
|
||||
|
||||
<pre>
|
||||
<body ng:controller="MainCtrl">
|
||||
<body ng-controller="MainCtrl">
|
||||
<p>Good {{timeOfDay}}, {{name}}!</p>
|
||||
<div ng:controller="ChildCtrl">
|
||||
<div ng-controller="ChildCtrl">
|
||||
<p>Good {{timeOfDay}}, {{name}}!</p>
|
||||
<p ng:controller="BabyCtrl">Good {{timeOfDay}}, {{name}}!</p>
|
||||
<p ng-controller="BabyCtrl">Good {{timeOfDay}}, {{name}}!</p>
|
||||
</body>
|
||||
|
||||
function MainCtrl($scope) {
|
||||
|
|
@ -186,7 +186,7 @@ function BabyCtrl($scope) {
|
|||
}
|
||||
</pre>
|
||||
|
||||
Notice how we nested three `ng:controller` directives in our template. This template construct will
|
||||
Notice how we nested three `ng-controller` directives in our template. This template construct will
|
||||
result in 4 scopes being created for our view:
|
||||
|
||||
- The root scope
|
||||
|
|
|
|||
|
|
@ -28,26 +28,26 @@ occurs in controllers:
|
|||
|
||||
* Use an {@link dev_guide.expressions angular expression} with an assignment operator in templates:
|
||||
|
||||
<button ng:click="{{foos='ball'}}">Click me</button>
|
||||
<button ng-click="{{foos='ball'}}">Click me</button>
|
||||
|
||||
* Use {@link api/angular.module.ng.$compileProvider.directive.ng:init ng:init directive} in templates (for toy/example apps
|
||||
* Use {@link api/angular.module.ng.$compileProvider.directive.ng-init ng-init directive} in templates (for toy/example apps
|
||||
only, not recommended for real applications):
|
||||
|
||||
<body ng:init=" foo = 'bar' ">
|
||||
<body ng-init=" foo = 'bar' ">
|
||||
|
||||
Angular creates models implicitly (by creating a scope property and assigning it a suitable value)
|
||||
when processing the following template constructs:
|
||||
|
||||
* Form input, select, textarea and other form elements:
|
||||
|
||||
<input ng:model="query" value="fluffy cloud">
|
||||
<input ng-model="query" value="fluffy cloud">
|
||||
|
||||
The code above creates a model called "query" on the current scope with the value set to "fluffy
|
||||
cloud".
|
||||
|
||||
* An iterator declaration in {@link api/angular.module.ng.$compileProvider.directive.@ng:repeat ng:repeater}:
|
||||
* An iterator declaration in {@link api/angular.module.ng.$compileProvider.directive.ng-repeat ng-repeater}:
|
||||
|
||||
<p ng:repeat="phone in phones"></p>
|
||||
<p ng-repeat="phone in phones"></p>
|
||||
|
||||
The code above creates one child scope for each item in the "phones" array and creates a "phone"
|
||||
object (model) on each of these scopes with its value set to the value of "phone" in the array.
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ the DOM based on information in the template, controller and model.
|
|||
|
||||
In the angular implementation of MVC, the view has knowledge of both the model and the controller.
|
||||
The view knows about the model where two-way data-binding occurs. The view has knowledge of the
|
||||
controller through angular directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng:controller
|
||||
ng:controller} and {@link api/angular.module.ng.$compileProvider.directive.ng:view ng:view}, and through bindings of this form:
|
||||
controller through angular directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng-controller
|
||||
ng-controller} and {@link api/angular.module.ng.$compileProvider.directive.ng-view ng-view}, and through bindings of this form:
|
||||
`{{someControllerFunction()}}`. In these ways, the view can call functions in an associated
|
||||
controller function.
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ easier a web developer's life can if they're using angular:
|
|||
$scope.cost = 19.95;
|
||||
}
|
||||
</script>
|
||||
<div ng:controller="InvoiceCntl">
|
||||
<div ng-controller="InvoiceCntl">
|
||||
<b>Invoice:</b>
|
||||
<br />
|
||||
<br />
|
||||
|
|
@ -56,8 +56,8 @@ easier a web developer's life can if they're using angular:
|
|||
<tr><td> </td><td> </td>
|
||||
<tr><td>Quantity</td><td>Cost</td></tr>
|
||||
<tr>
|
||||
<td><input type="integer" min="0" ng:model="qty" required ></td>
|
||||
<td><input type="number" ng:model="cost" required ></td>
|
||||
<td><input type="integer" min="0" ng-model="qty" required ></td>
|
||||
<td><input type="number" ng-model="cost" required ></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
|
|
@ -81,20 +81,20 @@ on.
|
|||
|
||||
In the `<html>` tag, we add an attribute to let the browser know about the angular namespace.
|
||||
This ensures angular runs nicely in all major browsers. We also specify that it is an angular
|
||||
application with the `ng:app` directive. The `ng:app' will cause the angular to {@link
|
||||
application with the `ng-app` directive. The `ng-app' will cause the angular to {@link
|
||||
dev_guide.bootstrap auto initialize} your application.
|
||||
|
||||
<html xmlns:ng="http://angularjs.org" ng:app>
|
||||
<html ng-ng-app>
|
||||
|
||||
We load the angular using the `<script>` tag:
|
||||
|
||||
<script src="http://code.angularjs.org/angular-?.?.?.min.js"></script>
|
||||
|
||||
From the `ng:model` attribute of the `<input>` tags, angular automatically sets up two-way data
|
||||
From the `ng-model` attribute of the `<input>` tags, angular automatically sets up two-way data
|
||||
binding, and we also demonstrate some easy input validation:
|
||||
|
||||
Quantity: <input type="integer" min="0" ng:model="qty" required >
|
||||
Cost: <input type="number" ng:model="cost" required >
|
||||
Quantity: <input type="integer" min="0" ng-model="qty" required >
|
||||
Cost: <input type="number" ng-model="cost" required >
|
||||
|
||||
These input widgets look normal enough, but consider these points:
|
||||
|
||||
|
|
@ -111,10 +111,10 @@ And finally, the mysterious `{{ double curly braces }}`:
|
|||
|
||||
Total: {{qty * cost | currency}}
|
||||
|
||||
This notation, `{{ _expression_ }}`, is a bit of built-in angular {@link dev_guide.compiler.markup
|
||||
This notation, `{{ _expression_ }}`, is a bit of built-in angular {@link http://localhost:8000/build/docs/api/angular.module.ng.$interpolate
|
||||
markup}, a shortcut for displaying data to the user. The expression within curly braces gets
|
||||
transformed by the angular compiler into an angular directive ({@link api/angular.module.ng.$compileProvider.directive.ng:bind
|
||||
ng:bind}). The expression itself can be a combination of both an expression and a {@link
|
||||
transformed by the angular compiler into an angular directive ({@link api/angular.module.ng.$compileProvider.directive.ng-bind
|
||||
ng-bind}). The expression itself can be a combination of both an expression and a {@link
|
||||
dev_guide.templates.filters filter}: `{{ expression | filter }}`. Angular provides filters for
|
||||
formatting display data.
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ recursively check the parent scope, grandparent scope, etc. all the way to the r
|
|||
defaulting to undefined.
|
||||
|
||||
{@link api/angular.module.ng.$compileProvider.directive directives} associated with elements
|
||||
(ng:controller, ng:repeat, ng:include, etc.) create new child scopes that inherit properties from
|
||||
(ng-controller, ng-repeat, ng-include, etc.) create new child scopes that inherit properties from
|
||||
the current parent scope. Any code in Angular is free to create a new scope. Whether or not your
|
||||
code does so is an implementation detail of the directive, that is, you can decide when or if this
|
||||
happens. Inheritance typically mimics HTML DOM element nesting, but does not do so with the same
|
||||
|
|
@ -123,8 +123,8 @@ usually fall into one of two categories:
|
|||
expressions `{{expression}}`, register listeners using the {@link
|
||||
api/angular.module.ng.$rootScope.Scope#$watch $watch()} method. This type of directive needs to
|
||||
be notified whenever the expression changes so that it can update the view.
|
||||
- Listener directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng:click
|
||||
ng:click}, register a listener with the DOM. When the DOM listener fires, the directive executes
|
||||
- Listener directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng-click
|
||||
ng-click}, register a listener with the DOM. When the DOM listener fires, the directive executes
|
||||
the associated expression and updates the view using the {@link
|
||||
api/angular.module.ng.$rootScope.Scope#$apply $apply()} method.
|
||||
3. When an external event (such as a user action, timer or XHR) is received, the associated {@link
|
||||
|
|
@ -134,8 +134,8 @@ api/angular.module.ng.$rootScope.Scope#$apply $apply()} method so that all liste
|
|||
|
||||
### Directives that create scopes
|
||||
In most cases, {@link api/angular.module.ng.$compileProvider.directive directives} and scopes interact but do not create new
|
||||
instances of scope. However, some directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng:controller
|
||||
ng:controller} and {@link api/angular.module.ng.$compileProvider.directive.@ng:repeat ng:repeat}, create new child scopes using
|
||||
instances of scope. However, some directives, such as {@link api/angular.module.ng.$compileProvider.directive.ng-controller
|
||||
ng-controller} and {@link api/angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat}, create new child scopes using
|
||||
the {@link api/angular.module.ng.$rootScope.Scope#$new $new()} method and then attach the child scope to the
|
||||
corresponding DOM element. You can retrieve a scope for any DOM element by using an
|
||||
`angular.element(aDomElement).scope()` method call.)
|
||||
|
|
@ -144,7 +144,7 @@ corresponding DOM element. You can retrieve a scope for any DOM element by using
|
|||
### Controllers and scopes
|
||||
Scopes and controllers interact with each other in the following situations:
|
||||
- Controllers use scopes to expose controller methods to templates (see {@link
|
||||
api/angular.module.ng.$compileProvider.directive.ng:controller ng:controller}).
|
||||
api/angular.module.ng.$compileProvider.directive.ng-controller ng-controller}).
|
||||
- Controllers define methods (behavior) that can mutate the model (properties on the scope).
|
||||
- Controllers may register {@link api/angular.module.ng.$rootScope.Scope#$watch watches} on the model. These watches
|
||||
execute immediately after the controller behavior executes, but before the DOM gets updated.
|
||||
|
|
@ -170,7 +170,7 @@ $watch-ers firing and view getting updated. Similarly, when a request to fetch d
|
|||
is made and the response comes back, the data is written into the model (scope) within an $apply,
|
||||
which then pushes updates through to the view and any other dependents.
|
||||
|
||||
A widget that creates scopes (such as {@link api/angular.module.ng.$compileProvider.directive.@ng:repeat ng:repeat}) via `$new`,
|
||||
A widget that creates scopes (such as {@link api/angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat}) via `$new`,
|
||||
doesn't need to worry about propagating the `$digest` call from the parent scope to child scopes.
|
||||
This happens automatically.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ the contexts in which Angular creates data-bindings between the model and the vi
|
|||
In addition to providing the context in which data is evaluated, Angular scope objects watch for
|
||||
model changes. The scope objects also notify all components interested in any model changes (for
|
||||
example, functions registered through {@link api/angular.module.ng.$rootScope.Scope#$watch $watch}, bindings created by
|
||||
{@link api/angular.module.ng.$compileProvider.directive.ng:bind ng:bind}, or HTML input elements).
|
||||
{@link api/angular.module.ng.$compileProvider.directive.ng-bind ng-bind}, or HTML input elements).
|
||||
|
||||
Angular scope objects:
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ code, observe how the value of `name` changes, based on the HTML element it is d
|
|||
|
||||
<doc:example>
|
||||
<doc:source>
|
||||
<ul ng:init="name='Hank'; names=['Igor', 'Misko', 'Gail', 'Kai']">
|
||||
<li ng:repeat="name in names">
|
||||
<ul ng-init="name='Hank'; names=['Igor', 'Misko', 'Gail', 'Kai']">
|
||||
<li ng-repeat="name in names">
|
||||
Name = {{name}}!
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -45,7 +45,7 @@ code, observe how the value of `name` changes, based on the HTML element it is d
|
|||
</doc:scenario>
|
||||
</doc:example>
|
||||
|
||||
The angular {@link api/angular.module.ng.$compileProvider.directive.@ng:repeat ng:repeat} directive creates a new scope for each
|
||||
The angular {@link api/angular.module.ng.$compileProvider.directive.ng-repeat ng-repeat} directive creates a new scope for each
|
||||
element that it repeats (in this example the elements are list items). In the `<ul>` element, we
|
||||
initialized `name` to "Hank", and we created an array called `names` to use as the data source for
|
||||
the list items. In each `<li>` element, `name` is overridden. Outside of the `<li>` repeater, the
|
||||
|
|
|
|||
|
|
@ -316,8 +316,8 @@ When a user clicks on this link,
|
|||
In cases like the following, links are not rewritten; instead, the browser will perform a full page
|
||||
reload to the original link.
|
||||
|
||||
- Links with an `ng:ext-link` directive<br />
|
||||
Example: `<a href="/ext/link?a=b" ng:ext-link>link</a>`
|
||||
- Links with an `ng-ext-link` directive<br />
|
||||
Example: `<a href="/ext/link?a=b" ng-ext-link>link</a>`
|
||||
- Links that contain `target="_blank"`<br />
|
||||
Example: `<a href="/ext/link?a=b" target="_blank">link</a>`
|
||||
- Absolute links that go to a different domain<br />
|
||||
|
|
@ -369,10 +369,10 @@ In this examples we use `<base href="/base/index.html" />`
|
|||
<doc:example>
|
||||
<doc:source source="false">
|
||||
|
||||
<div ng:non-bindable class="html5-hashbang-example">
|
||||
<div id="html5-mode" ng:controller="Html5Cntl">
|
||||
<div ng-non-bindable class="html5-hashbang-example">
|
||||
<div id="html5-mode" ng-controller="Html5Cntl">
|
||||
<h3>Browser with History API</h3>
|
||||
<ng:address-bar browser="html5"></ng:address-bar><br /><br />
|
||||
<ng-address-bar browser="html5"></ng-address-bar><br /><br />
|
||||
$location.protocol() = {{$location.protocol()}}<br />
|
||||
$location.host() = {{$location.host()}}<br />
|
||||
$location.port() = {{$location.port()}}<br />
|
||||
|
|
@ -381,12 +381,12 @@ In this examples we use `<base href="/base/index.html" />`
|
|||
$location.hash() = {{$location.hash()}}<br />
|
||||
<a href="/base/first?a=b">/base/first?a=b</a> |
|
||||
<a href="sec/ond?flag#hash">sec/ond?flag#hash</a> |
|
||||
<a href="/base/another?search" ng:ext-link>external</a>
|
||||
<a href="/base/another?search" ng-ext-link>external</a>
|
||||
</div>
|
||||
|
||||
<div id="hashbang-mode" ng:controller="HashbangCntl">
|
||||
<div id="hashbang-mode" ng-controller="HashbangCntl">
|
||||
<h3>Browser without History API</h3>
|
||||
<ng:address-bar browser="hashbang"></ng:address-bar><br /><br />
|
||||
<ng-address-bar browser="hashbang"></ng-address-bar><br /><br />
|
||||
$location.protocol() = {{$location.protocol()}}<br />
|
||||
$location.host() = {{$location.host()}}<br />
|
||||
$location.port() = {{$location.port()}}<br />
|
||||
|
|
@ -395,7 +395,7 @@ In this examples we use `<base href="/base/index.html" />`
|
|||
$location.hash() = {{$location.hash()}}<br />
|
||||
<a href="/base/first?a=b">/base/first?a=b</a> |
|
||||
<a href="sec/ond?flag#hash">sec/ond?flag#hash</a> |
|
||||
<a href="/base/another?search" ng:ext-link>external</a>
|
||||
<a href="/base/another?search" ng-ext-link>external</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -614,7 +614,7 @@ https://github.com/angular/angular.js/issues/404 issue}). If you should require
|
|||
you will need to specify an extra property that has two watchers. For example:
|
||||
<pre>
|
||||
<!-- html -->
|
||||
<input type="text" ng:model="locationPath" />
|
||||
<input type="text" ng-model="locationPath" />
|
||||
</pre>
|
||||
<pre>
|
||||
// js - controller
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ text upper-case and assigns color.
|
|||
}
|
||||
</script>
|
||||
|
||||
<div ng:controller="Ctrl">
|
||||
<input ng:model="greeting" type="greeting"><br>
|
||||
<div ng-controller="Ctrl">
|
||||
<input ng-model="greeting" type="greeting"><br>
|
||||
No filter: {{greeting}}<br>
|
||||
Reverse: {{greeting|reverse}}<br>
|
||||
Reverse + uppercase: {{greeting|reverse:true}}<br>
|
||||
|
|
|
|||
|
|
@ -10,31 +10,28 @@ the dynamic view DOM.
|
|||
|
||||
These are the types of angular elements and element attributes you can use in a template:
|
||||
|
||||
* {@link dev_guide.compiler.directives Directive} — An attribute that augments an existing DOM
|
||||
* {@link api/angular.module.ng.$compileProvider.directive Directive} — An attribute that augments an existing DOM
|
||||
element.
|
||||
* {@link dev_guide.compiler.widgets Widget} — A custom DOM element. An example of a built-in widget
|
||||
is {@link api/angular.module.ng.$compileProvider.directive.@ng:repeat ng:repeat}.
|
||||
* {@link dev_guide.compiler.markup Markup} — Shorthand for a widget or a directive. The double
|
||||
* {@link api/angular.module.ng.$interpolate Markup} — The double
|
||||
curly brace notation `{{ }}` to bind expressions to elements is built-in angular markup.
|
||||
* {@link dev_guide.templates.filters Filter} — Formats your data for display to the user.
|
||||
* {@link dev_guide.forms Form widgets} — Lets you validate user input.
|
||||
* {@link dev_guide.forms Form controls} — Lets you validate user input.
|
||||
|
||||
Note: In addition to declaring the elements above in templates, you can also access these elements
|
||||
in JavaScript code.
|
||||
|
||||
The following code snippet shows a simple angular template made up of standard HTML tags along with
|
||||
angular {@link dev_guide.compiler.directives directives}, {@link dev_guide.compiler.markup markup},
|
||||
and {@link dev_guide.expressions expressions}:
|
||||
angular {@link api/angular.module.ng.$compileProvider.directive directives} and {@link dev_guide.expressions expressions}:
|
||||
|
||||
<pre>
|
||||
<html ng:app>
|
||||
<!-- Body tag augmented with ng:controller directive -->
|
||||
<body ng:controller="MyController">
|
||||
<input ng:model="foo" value="bar">
|
||||
<!-- Button tag with ng:click directive, and
|
||||
<html ng-app>
|
||||
<!-- Body tag augmented with ng-controller directive -->
|
||||
<body ng-controller="MyController">
|
||||
<input ng-model="foo" value="bar">
|
||||
<!-- Button tag with ng-click directive, and
|
||||
string expression 'buttonText'
|
||||
wrapped in "{{ }}" markup -->
|
||||
<button ng:click="changeFoo()">{{buttonText}}</button>
|
||||
<button ng-click="changeFoo()">{{buttonText}}</button>
|
||||
<script src="angular.js">
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -44,7 +41,7 @@ In a simple single-page app, the template consists of HTML, CSS, and angular dir
|
|||
in just one HTML file (usually `index.html`). In a more complex app, you can display multiple views
|
||||
within one main page using "partials", which are segments of template located in separate HTML
|
||||
files. You "include" the partials in the main page using the {@link api/angular.module.ng.$route
|
||||
$route} service in conjunction with the {@link api/angular.module.ng.$compileProvider.directive.ng:view ng:view} directive. An
|
||||
$route} service in conjunction with the {@link api/angular.module.ng.$compileProvider.directive.ng-view ng-view} directive. An
|
||||
example of this technique is shown in the {@link tutorial/ angular tutorial}, in steps seven and
|
||||
eight.
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,7 @@ of the following documents before returning here to the Developer Guide:
|
|||
|
||||
## {@link dev_guide.compiler Angular HTML Compiler}
|
||||
|
||||
* {@link dev_guide.compiler.directives Understanding Angular Directives}
|
||||
* {@link dev_guide.compiler.widgets Understanding Angular Widgets}
|
||||
* {@link dev_guide.compiler.directives_widgets Comparing Directives and Widgets}
|
||||
* {@link dev_guide.compiler.markup Understanding Angular Markup}
|
||||
* {@link api/angular.module.ng.$compileProvider.directive Understanding Angular Directives}
|
||||
|
||||
## {@link dev_guide.templates Angular Templates}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Ok, I'm in a hurry how do i get a Hello World module working?
|
|||
Important things to notice:
|
||||
|
||||
* {@link api/angular.Module Module} API
|
||||
* Notice the reference to the `myApp` module in the `<html ng:app="myApp">`, it is what
|
||||
* Notice the reference to the `myApp` module in the `<html ng-app="myApp">`, it is what
|
||||
bootstraps the app using your module.
|
||||
|
||||
<doc:example module='simpleApp'>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ example points to (non-minified) version 0.9.12:
|
|||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html xmlns:ng="http://angularjs.org" ng:app>
|
||||
<html xmlns:ng="http://angularjs.org" ng-app>
|
||||
<head>
|
||||
<title>My Angular App</title>
|
||||
<script src="http://code.angularjs.org/angular-0.9.12.js"></script>
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ the scenes.
|
|||
|
||||
The first line of interest defines the `ng` namespace, which makes
|
||||
AngularJS work across all browsers (especially important for IE). The
|
||||
`ng:app` tags tells angular to process the entire HTML when it is loaded:
|
||||
`ng-app` tags tells angular to process the entire HTML when it is loaded:
|
||||
|
||||
<pre>
|
||||
<html xmlns:ng="http://angularjs.org" ng:app>
|
||||
<html ng-app>
|
||||
</pre>
|
||||
|
||||
The next line downloads the angular script:
|
||||
|
|
@ -66,7 +66,7 @@ This example demonstrates angular's two-way data binding:
|
|||
|
||||
<doc:example>
|
||||
<doc:source>
|
||||
Your name: <input type="text" ng:model="yourname" value="World"/>
|
||||
Your name: <input type="text" ng-model="yourname" value="World"/>
|
||||
<hr/>
|
||||
Hello {{yourname}}!
|
||||
</doc:source>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ describe('ngdoc', function() {
|
|||
|
||||
it('should have shortName', function() {
|
||||
var d1 = new Doc('@name a.b.c').parse();
|
||||
var d2 = new Doc('@name a.b.ng:c').parse();
|
||||
var d2 = new Doc('@name a.b.ng-c').parse();
|
||||
var d3 = new Doc('@name some text: more text').parse();
|
||||
expect(ngdoc.metadata([d1])[0].shortName).toEqual('c');
|
||||
expect(ngdoc.metadata([d2])[0].shortName).toEqual('ng:c');
|
||||
|
|
@ -41,7 +41,7 @@ describe('ngdoc', function() {
|
|||
|
||||
it('should have depth information', function() {
|
||||
var d1 = new Doc('@name a.b.c').parse();
|
||||
var d2 = new Doc('@name a.b.ng:c').parse();
|
||||
var d2 = new Doc('@name a.b.ng-c').parse();
|
||||
var d3 = new Doc('@name some text: more text').parse();
|
||||
expect(ngdoc.metadata([d1])[0].depth).toEqual(2);
|
||||
expect(ngdoc.metadata([d2])[0].depth).toEqual(2);
|
||||
|
|
@ -458,7 +458,7 @@ describe('ngdoc', function() {
|
|||
'dad{@link angular.foo}\n\n' +
|
||||
'external{@link http://angularjs.org}\n\n' +
|
||||
'external{@link ./static.html}\n\n' +
|
||||
'{@link angular.directive.ng:foo ng:foo}');
|
||||
'{@link angular.directive.ng-foo ng:foo}');
|
||||
|
||||
doc.section = 'api';
|
||||
doc.parse();
|
||||
|
|
@ -470,7 +470,7 @@ describe('ngdoc', function() {
|
|||
expect(doc.description).
|
||||
toContain('dad<a href="api/angular.foo"><code>angular.foo</code></a>');
|
||||
expect(doc.description).
|
||||
toContain('<a href="api/angular.directive.ng:foo"><code>ng:foo</code></a>');
|
||||
toContain('<a href="api/angular.directive.ng-foo"><code>ng:foo</code></a>');
|
||||
expect(doc.description).
|
||||
toContain('<a href="http://angularjs.org">http://angularjs.org</a>');
|
||||
expect(doc.description).
|
||||
|
|
|
|||
|
|
@ -774,6 +774,7 @@ function merge(docs){
|
|||
if (link[0] == '#') {
|
||||
link = doc.section + '/' + doc.id.split('#').shift() + link;
|
||||
}
|
||||
link = link.split('#').shift();
|
||||
if (!byFullId[link]) {
|
||||
console.log('WARNING: In ' + doc.section + '/' + doc.id + ', non existing link: "' + link + '"');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ function $RouteProvider(){
|
|||
This example shows how changing the URL hash causes the `$route` to match a route against the
|
||||
URL, and the `ng-view` pulls in the partial.
|
||||
|
||||
Note that this example is using {@link angular.module.ng.$compileProvide.directive.script inlined templates}
|
||||
Note that this example is using {@link angular.module.ng.$compileProvider.directive.script inlined templates}
|
||||
to get it working on jsfiddle as well.
|
||||
|
||||
<doc:example module="route">
|
||||
|
|
|
|||
Loading…
Reference in a new issue