@@ -15,11 +15,11 @@ directives per element.
15
15
You add angular directives to a standard HTML tag as in the following example, in which we have
16
16
added the {@link api/angular.directive.ng:click ng:click} directive to a button tag:
17
17
18
- <button ng:model="button1" ng: click="foo()">Click This</button>
18
+ <button ng:click="foo()">Click This</button>
19
19
20
- In the example above, `name` is the standard HTML attribute, and `ng:click` is the angular
21
- directive. The `ng:click` directive lets you implement custom behavior in an associated controller
22
- function .
20
+ The `ng:click` directive lets you specify click event handlers directly in the template. Unlike the
21
+ evil `onclick` attribute, the expression associated with the `ng:click` directive is always executed
22
+ in the context of the current angular scope .
23
23
24
24
In the next example, we add the {@link api/angular.directive.ng:bind ng:bind} directive to a
25
25
`<span>` tag:
@@ -30,8 +30,9 @@ The `ng:bind` directive tells angular to set up {@link dev_guide.templates.datab
30
30
binding} between the data model and the view for the specified expression. When the angular {@link
31
31
dev_guide.compiler compiler} encounters an `ng:bind` directive in a template, it passes the
32
32
attribute value to the `ng:bind` function, which in turn sets up the data binding. On any change to
33
- the expression in the model, the view is updated to display the span text with the changed
34
- expression value.
33
+ the model that would change the result of the expression, the view is updated and the text of the
34
+ span element will reflect the new value. In the example above, the model is represented by two
35
+ constants, so nothing will ever change - Sorry!
35
36
36
37
37
38
## Related Topics
0 commit comments