mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
docs(*): fixing various docs
This commit is contained in:
parent
8b8fdddc0b
commit
716b5fd3e2
10 changed files with 34 additions and 32 deletions
|
|
@ -12,7 +12,7 @@ explicitly.
|
|||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html xmlns:ng="http://angularjs.org">
|
||||
<html>
|
||||
<head>
|
||||
<script src="http://code.angularjs.org/angular.js"></script>
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ and manage the whole page. You do this as follows:
|
|||
|
||||
<html xmlns:ng="http://angularjs.org">
|
||||
|
||||
You need to declare the angular namespace declaration in the following cases:
|
||||
|
||||
* For all types of browser if you are using XHTML.
|
||||
* For Internet Explorer older than version 9 (because older versions of IE do not render namespace
|
||||
properly for either HTML or XHTML).
|
||||
You need to add the angular namespace declaration if you use `ng:something` style of declaring
|
||||
angular directives and you write your templates as XHTML. Or when you are targeting Internet
|
||||
Explorer older than version 9 (because older versions of IE do not render namespace
|
||||
properly for either HTML or XHTML). For more info please read {@link ie Internet Explorer
|
||||
Compatibility} doc.
|
||||
|
||||
|
||||
## Creating Your Own Namespaces
|
||||
|
|
|
|||
|
|
@ -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 ng-controller="MyController" ng-app>
|
||||
<script src="http://code.angularjs.org/angular.min.js"></script>
|
||||
<body>
|
||||
...
|
||||
|
|
|
|||
|
|
@ -236,6 +236,10 @@ 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.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 directive}.
|
||||
|
||||
All localizable Angular components depend on locale-specific rule sets managed by the {@link
|
||||
api/angular.module.ng.$locale $locale service}.
|
||||
|
|
|
|||
|
|
@ -65,9 +65,9 @@ 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 and
|
||||
you have to perform your own manual DOM manipulation, encapsulate the presentation logic in
|
||||
{@link api/angular.module.ng.$compileProvider.directive directives}.
|
||||
- Input formatting — Use {@link dev_guide.forms angular form widgets} instead.
|
||||
- Input formatting — Use {@link dev_guide.forms angular form controls} 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
|
||||
services} instead.
|
||||
|
|
|
|||
|
|
@ -79,12 +79,10 @@ easier a web developer's life can if they're using angular:
|
|||
Try out the Live Preview above, and then let's walk through the example and describe what's going
|
||||
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
|
||||
dev_guide.bootstrap auto initialize} your application.
|
||||
In the `<html>` tag we specify that this is an angular application with the `ng-app` directive.
|
||||
The `ng-app' will cause the angular to {@link dev_guide.bootstrap auto initialize} your application.
|
||||
|
||||
<html ng-ng-app>
|
||||
<html ng-app>
|
||||
|
||||
We load the angular using the `<script>` tag:
|
||||
|
||||
|
|
@ -111,12 +109,12 @@ And finally, the mysterious `{{ double curly braces }}`:
|
|||
|
||||
Total: {{qty * cost | currency}}
|
||||
|
||||
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
|
||||
dev_guide.templates.filters filter}: `{{ expression | filter }}`. Angular provides filters for
|
||||
formatting display data.
|
||||
This notation, `{{ _expression_ }}`, is a bit of built-in angular binding markup, a shortcut for
|
||||
displaying data to the user. The expression within curly braces is monitored and its evaluated value
|
||||
is updated into the view by angular's template compiler. Alternatively, one could use angular's
|
||||
{@link api/angular.module.ng.$compileProvider.directive.ng-bind ng-bind}) directive. 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.
|
||||
|
||||
In the example above, the expression in double-curly braces directs angular to, "Bind the data we
|
||||
got from the input widgets to the display, multiply them together, and format the resulting number
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ the dynamic view DOM.
|
|||
|
||||
These are the types of angular elements and element attributes you can use in a template:
|
||||
|
||||
* {@link api/angular.module.ng.$compileProvider.directive Directive} — An attribute that augments an existing DOM
|
||||
element.
|
||||
* {@link api/angular.module.ng.$compileProvider.directive Directive} — An attribute or element that
|
||||
augments an existing DOM element or represents a reusable DOM component - a widget.
|
||||
* {@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.
|
||||
|
|
@ -21,7 +21,8 @@ Note: In addition to declaring the elements above in templates, you can also ac
|
|||
in JavaScript code.
|
||||
|
||||
The following code snippet shows a simple angular template made up of standard HTML tags along with
|
||||
angular {@link api/angular.module.ng.$compileProvider.directive directives} and {@link dev_guide.expressions expressions}:
|
||||
angular {@link api/angular.module.ng.$compileProvider.directive directives} and curly-brace bindings
|
||||
with {@link dev_guide.expressions expressions}:
|
||||
|
||||
<pre>
|
||||
<html ng-app>
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ development.
|
|||
production.
|
||||
|
||||
To point your code to an angular script on the angular server, use the following template. This
|
||||
example points to (non-minified) version 0.9.12:
|
||||
example points to (non-minified) version 0.10.6:
|
||||
|
||||
<pre>
|
||||
<!doctype html>
|
||||
<html xmlns:ng="http://angularjs.org" ng-app>
|
||||
<html ng-app>
|
||||
<head>
|
||||
<title>My Angular App</title>
|
||||
<script src="http://code.angularjs.org/angular-0.9.12.js"></script>
|
||||
<script src="http://code.angularjs.org/angular-0.10.6.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -21,14 +21,13 @@ A great way for you to get started with AngularJS is to create the tradtional
|
|||
|
||||
The resulting web page should look something like the following:
|
||||
|
||||
<img class="center" src="img/helloworld.png" border="1" />
|
||||
<img class="center" src="img/helloworld.png" border="1">
|
||||
|
||||
Now let's take a closer look at that code, and see what is going on behind
|
||||
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:
|
||||
The `ng-app` tags tells angular to process the entire HTML page and bootstrap the app when the page
|
||||
is loaded:
|
||||
|
||||
<pre>
|
||||
<html ng-app>
|
||||
|
|
@ -37,7 +36,7 @@ AngularJS work across all browsers (especially important for IE). The
|
|||
The next line downloads the angular script:
|
||||
|
||||
<pre>
|
||||
<script type="text/javascript" src="http://code.angularjs.org/angular-?.?.?.min.js"></script>
|
||||
<script src="http://code.angularjs.org/angular-?.?.?.min.js"></script>
|
||||
</pre>
|
||||
|
||||
(For details on what happens when angular processes an HTML page,
|
||||
|
|
|
|||
Loading…
Reference in a new issue