diff options
| author | Igor Minar | 2011-11-28 18:04:01 -0500 |
|---|---|---|
| committer | Igor Minar | 2011-11-28 18:04:01 -0500 |
| commit | a035e8839730ee19dfdabbb9c85d39ea16566f09 (patch) | |
| tree | 4230e8e90af987d77c244df3ab58b3658a9256ac /docs/content | |
| parent | 3548fe31398c1287817e486577a08902cf916a61 (diff) | |
| download | angular.js-a035e8839730ee19dfdabbb9c85d39ea16566f09.tar.bz2 | |
docs(guide): fix directives guide docs
Diffstat (limited to 'docs/content')
| -rw-r--r-- | docs/content/guide/dev_guide.compiler.directives.ngdoc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/docs/content/guide/dev_guide.compiler.directives.ngdoc b/docs/content/guide/dev_guide.compiler.directives.ngdoc index 8fcbdb40..651a8815 100644 --- a/docs/content/guide/dev_guide.compiler.directives.ngdoc +++ b/docs/content/guide/dev_guide.compiler.directives.ngdoc @@ -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 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 -directive. The `ng:click` directive lets you implement custom behavior in an associated controller -function. +The `ng:click` directive lets you specify click event handlers directly in the template. Unlike the +evil `onclick` attribute, the expression associated with the `ng:click` directive is always executed +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 `<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 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 -the expression in the model, the view is updated to display the span text with the changed -expression value. +the model that would change the result of the expression, the view is updated and the text of the +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 |
