美文网首页
angular 的自定义指令

angular 的自定义指令

作者: 宏_4491 | 来源:发表于2020-07-24 12:08 被阅读0次
创建一个模板
var demoApp= angular.module("demoApp",[])
demoApp.directive("btn",[function(){
return{
scope:{
primary:"@",
block:"@",
lg:"@",
}  
        restrict: 'E',// 指令类型  E:element A:attribute M:comment C: class
        template: '<button>我是指令生成的内容</button>';
        replace: true, //使用模板替换原始标记  指令内原本的数据将被清空
}
}])

相关文章

网友评论

      本文标题:angular 的自定义指令

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