user93 user93 - 10 months ago 45
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


In the controller you have the $attrs :)

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