user93 user93 - 5 months ago 19
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);