【发布时间】:2014-08-13 01:40:34
【问题描述】:
当我在正常功能中更改 ng-if 条件时,我可以使 ng-animate 在 ng-if 中工作,例如
我的看法:
<div ng-if="!show">
<a ng-click="showWorld()">Hello</a>
</div>
<div ng-if="show" class="animation">
Hello world!
</div>
我在指令中的功能:
scope.showWorld = function() {
scope.show = true;
}
当我调用 showWorld() 函数来改变 ng-if 条件,Hello world!会出现动画,但如果我这样做:
scope.showWorld = function() {
Post.test(params, function(){
scope.show = true;
})
}
Post 是有角度的 $resource,例如:
$resource('api/post', {}, {test: {method: 'POST'}})
而且 scope.show 仍然会改变,Hello world!仍然显示,但动画不工作...
我在网上找了半天也没找到答案,谁能告诉我为什么??
非常感谢!!
【问题讨论】:
标签: angularjs ng-animate