0
因此,在此示例中,ng-hide不会隐藏该元素。为什么以及如何解决这个问题?指令中的重新连接指令
<div ng-app='myApp'>
<input type='text' foo/>
</div>
angular.module('myApp',[])
.directive('foo',function(){
return{
link:function(scope,element,attrs){
element.after('<div style="width:200px; height:200px;'
+' background-color:red" ng-hide="true"></div>')
}
}
});
使用'$ compile'服务,以便指令和绑定被逮住。 – 2013-04-09 21:37:45