Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 1.03 KB

text_directive.rst

File metadata and controls

46 lines (34 loc) · 1.03 KB

Text directives

Overview

An able to control a declarative data binding in the HTML

<div al-app>
    counter {{#counter}}
</div>
alight.text.counter = function(callback, expression, cd) {
    var n = 0;
    setInterval(function(){
        n++;
        callback(n)     // set result
        cd.scan()       // $digest
    }, 1000);
}

Input arguments

  • callback - a function to set a value
  • expression - expression of directive
  • cd - change detector
  • env. finally - a function to set the final value, after that $watch will be removed.
  • env.setter = callback

Examples