创建一个模板
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, //使用模板替换原始标记 指令内原本的数据将被清空
}
}])
网友评论