遇到一个 angular(1.0.8) 的问题,赶快来笔记一下。

在 ng-repeat 中,有 directive 是以 templateUrl 的方式去载入 template,有一些灵异现象会发生.....

 

 

若按下 x 会发现没有反应。

 

目前的解法是不要将 alert directive 和 ng-repeat 写在同一个 tag 上,可以加上 transclude: true 来达到或者直接分开写,或是改换 template 的写法,不用 templateUrl

参考资料:

http://stackoverflow.com/questions/18236267/ng-repeat-not-binding-when-directive-template-is-loaded-via-templateurl

https://github.com/angular/angular.js/issues/2151

https://groups.google.com/forum/#!msg/angular/0CP0zpTnZMM/5OzBni7d9sgJ

查看原文 >>
相关文章