mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-19 14:21:02 +00:00
docs(guide): fix directives guide docs
This commit is contained in:
parent
3548fe3139
commit
a035e88397
1 changed files with 7 additions and 6 deletions
|
|
@ -15,11 +15,11 @@ directives per element.
|
||||||
You add angular directives to a standard HTML tag as in the following example, in which we have
|
You add angular directives to a standard HTML tag as in the following example, in which we have
|
||||||
added the {@link api/angular.directive.ng:click ng:click} directive to a button tag:
|
added the {@link api/angular.directive.ng:click ng:click} directive to a button tag:
|
||||||
|
|
||||||
<button ng:model="button1" ng:click="foo()">Click This</button>
|
<button ng:click="foo()">Click This</button>
|
||||||
|
|
||||||
In the example above, `name` is the standard HTML attribute, and `ng:click` is the angular
|
The `ng:click` directive lets you specify click event handlers directly in the template. Unlike the
|
||||||
directive. The `ng:click` directive lets you implement custom behavior in an associated controller
|
evil `onclick` attribute, the expression associated with the `ng:click` directive is always executed
|
||||||
function.
|
in the context of the current angular scope.
|
||||||
|
|
||||||
In the next example, we add the {@link api/angular.directive.ng:bind ng:bind} directive to a
|
In the next example, we add the {@link api/angular.directive.ng:bind ng:bind} directive to a
|
||||||
`<span>` tag:
|
`<span>` tag:
|
||||||
|
|
@ -30,8 +30,9 @@ The `ng:bind` directive tells angular to set up {@link dev_guide.templates.datab
|
||||||
binding} between the data model and the view for the specified expression. When the angular {@link
|
binding} between the data model and the view for the specified expression. When the angular {@link
|
||||||
dev_guide.compiler compiler} encounters an `ng:bind` directive in a template, it passes the
|
dev_guide.compiler compiler} encounters an `ng:bind` directive in a template, it passes the
|
||||||
attribute value to the `ng:bind` function, which in turn sets up the data binding. On any change to
|
attribute value to the `ng:bind` function, which in turn sets up the data binding. On any change to
|
||||||
the expression in the model, the view is updated to display the span text with the changed
|
the model that would change the result of the expression, the view is updated and the text of the
|
||||||
expression value.
|
span element will reflect the new value. In the example above, the model is represented by two
|
||||||
|
constants, so nothing will ever change - Sorry!
|
||||||
|
|
||||||
|
|
||||||
## Related Topics
|
## Related Topics
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue