创建指令
(function () {
'use strict';
angular.module('moduleName')
.directive('directiveName', directiveName);
function directiveName(){
return{
restrict:'string',
priority:number,
template:'string',
templateUrl:'string',
replace:boolean,
transclude:boolean or 'element',
scope:boolean or string,
controller:function(){},
require:'string',
link: function(scope,element,attrs,ctrl,transclude){},
compile: function(element,attrs,transclude){
return {
pre: function(scope,element,attrs,controller){},
post: function(scope,element,attrs,controller){}
}
}
}
}
})();