美文网首页
angular学习笔记 -- 自定义指令

angular学习笔记 -- 自定义指令

作者: wangxingkang | 来源:发表于2016-06-28 14:18 被阅读26次

创建指令

   (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){} 
                              } 
                       }
                }
          }
   })();

相关文章

网友评论

      本文标题:angular学习笔记 -- 自定义指令

      本文链接:https://www.haomeiwen.com/subject/nlstjttx.html