最近在学习angularJS指令的时候,对指令对象中require属性和transclude属性同时设置为true比较疑惑,于是自己动手测试一下具体差异
index.html:
<simple>
<div>Inner content</div> </simple>自定义 simple指令
.directive("simple", function(){ return { restrict: "E", //transclude:true, //replace:true, scope:{ }, template:"哈哈哈" }
1.transclude:true2.replace:false 哈哈哈Inner content3.replace:true 哈哈哈哈哈哈4.replace:true transclude:true哈哈哈Inner content