user93 user93 - 1 year ago 69
AngularJS Question

how to trigger a function inside a directives controller when attribute to a directive changes

I am trying to call a function inside directives controller as soon as the value to directives attribute changes how do proceed with that thank in advance

Answer Source

In the controller you have the $attrs :)

$attrs.$observe("myAttr", function(newValue){
  console.log("the attribute my-attr changed to: ", newValue);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download