OLD | NEW |
1 part of angular.directive; | 1 part of angular.directive; |
2 | 2 |
3 /** | 3 /** |
4 * The ngBind attribute tells Angular to replace the text content of the | 4 * The ngBind attribute tells Angular to replace the text content of the |
5 * specified HTML element with the value of a given expression, and to update | 5 * specified HTML element with the value of a given expression, and to update |
6 * the text content when the value of that expression changes. | 6 * the text content when the value of that expression changes. |
7 * | 7 * |
8 * Typically, you don't use ngBind directly, but instead you use the double | 8 * Typically, you don't use ngBind directly, but instead you use the double |
9 * curly markup like {{ expression }} which is similar but less verbose. | 9 * curly markup like {{ expression }} which is similar but less verbose. |
10 * | 10 * |
11 * It is preferrable to use ngBind instead of {{ expression }} when a template | 11 * It is preferrable to use ngBind instead of {{ expression }} when a template |
12 * is momentarily displayed by the browser in its raw state before Angular | 12 * is momentarily displayed by the browser in its raw state before Angular |
13 * compiles it. Since ngBind is an element attribute, it makes the bindings | 13 * compiles it. Since ngBind is an element attribute, it makes the bindings |
14 * invisible to the user while the page is loading. | 14 * invisible to the user while the page is loading. |
15 * | 15 * |
16 * An alternative solution to this problem would be using the ngCloak directive. | 16 * An alternative solution to this problem would be using the ngCloak directive. |
17 */ | 17 */ |
18 @NgDirective( | 18 @Decorator( |
19 selector: '[ng-bind]', | 19 selector: '[ng-bind]', |
20 map: const {'ng-bind': '=>value'}) | 20 map: const {'ng-bind': '=>value'}) |
21 class NgBindDirective { | 21 class NgBind { |
22 final dom.Element element; | 22 final dom.Element element; |
23 | 23 |
24 NgBindDirective(this.element); | 24 NgBind(this.element); |
25 | 25 |
26 set value(value) => element.text = value == null ? '' : value.toString(); | 26 set value(value) => element.text = value == null ? '' : value.toString(); |
27 } | 27 } |
OLD | NEW |