Text directives¶
Overview¶
An able to control a declarative data binding in the HTML
example how to use text directives¶
<div al-app>
counter {{#counter}}
</div>
text directive counter¶
alight.text.counter = function(callback, expression, scope) {
var n = 0;
setInterval(function(){
n++;
callback(n) // set result
scope.$scan() // $digest
}, 1000);
}
Input arguments¶
- callback - a function to set a value
- expression - expression of directive
- scope
- env. finally - a function to set the final value, after that $watch will be removed.
- env.**setter** = callback