您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

javascript - angular自定义指令如何写

2026/1/26 12:19:35发布20次查看
现在我有这样三段类似的代码
{{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作用域里
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product