输入banner图图片脚本导航/分类

javascript-angular自定义指令如何写

现在我有这样三段类似的代码

       
       {{planStatuse.name}}

                
                {{_appType.name}}

                
                {{centerPage.name}}


我要把这三块代码写成一个自定义指令 ,但是以上代码有的有事件,有的没有事件,而且事件不一样,该如何写?

var eInput= angular.module("eInput", []);
eInput.directive('eInput',function(){

return {
    restrict: "A",
    template:' '+
   ' '+
    '{{inputList.name}}'+
'',
    replace:true,
    scope:{
        inputListes:'='
    }
}

});

回复内容:

现在我有这样三段类似的代码

       
       {{planStatuse.name}}

                
                {{_appType.name}}

                
                {{centerPage.name}}


我要把这三块代码写成一个自定义指令 ,但是以上代码有的有事件,有的没有事件,而且事件不一样,该如何写?

var eInput= angular.module("eInput", []);
eInput.directive('eInput',function(){

return {
    restrict: "A",
    template:' '+
   ' '+
    '{{inputList.name}}'+
'',
    replace:true,
    scope:{
        inputListes:'='
    }
}

});

你确认一下你每个要执行的函数是否都在controller作用域里