I am new to angular, I am still trying to learn a lot, there is one thing I came across,need to know if I can use link, controller, compile all together inside one single directive ?
For example , this is an example which I am working in some directive, while watching output, I came across that this link function doesn't work. Any reason for it not to work, or I have done an obvious mistake.
CODE
angular.module('app').directive('movies', function() {
return {
templateUrl: "movieCard.html",
restrict: "EA",
scope: { },
link: function(scope, element, attrs) {
console.log("link function called");
},
controller: function($scope) {
console.log("controller function called");
},
compile: function(elem,attrss){
console.log("compile function called");
}
}
})
I have created the Plunker