I have a very simple directive
.directive('myDirective', ['$window', function ($window) {
return {
restrict: 'AE',
scope: {
...
},
link: function ($scope) {
},
template:
'<SOME HTML...>'
};
}])
I need to execute some code once the directive is loaded. What I tried is to put inside link this:
element.on('load', function(event) {
console.log('loaded');
});
with no luck. What else should I do? Thanks.