The directive bellow return an object "directive". Can I return it to a function?
var sharedApp = angular.module("sharedApp", []);
sharedApp.directive("showAvatar", function () {
var directive = {
restrict: "ACEM",
replace: true,
template: "<h2>This is directive template of shared module</h2>"
};
return directive;
});
(Updated)For example
var sharedApp = angular.module("sharedApp", []);
sharedApp.directive("showAvatar", function () {
function directive(){
this.restrict = "ACEM";
this.replace = true;
this.template = "<h2>This is directive template of shared module</h2>";
}
return directive;
});