I'm having two directives with same functionality like below.
angular.module('ui.directives', [])
.directive('uiFoo',
function() {
return {
restrict: 'EAC',
link: function($scope, element, attrs) {
//to do functionality
element.append("test content");
}
};
})
.directive('uiFoo1',
function() {
return {
restrict: 'EAC',
link: function($scope, element, attrs) {
//to do functionality
element.append("test content");
}
};
});
They both contain the same working like here it is appending "test content" as text to that element. Is there any chance that instead making this two directive. Can i write two names for one directive/ I can use same functionality in with optimize code. Here I'm writing same code for without any meaning. Instead of writing directive two times, is there any optimize way. I'm new in AngularJS kindly help me. Thanks in advance!