<DirectiveName value1="someValue" functionRef="someFunction()"></DirectiveName>
angular.module('Name', ['Dependencies']).
directive('DirectiveName',
function($timeout) {
return {
restrict: 'AE',
replace: 'true',
template : 'HTML Template',
scope: {
variable1: '=value1',
Variable2: '&functionRef',
},
link: function(scope, watch){
}
};
});
- I am using this angular JS custom directive, where we are passing reference of method from HTML to get called.
- Now we want to execute another function as well after execution of referenced function i.e. Variable2
We can not call common function from HTML or parent controller hence we need to call common function from angular directive it self after the execution of referenced function i.e. Variable2