遇到一個 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

文章標籤
全站熱搜
創作者介紹
創作者 zack9433 的頭像
zack9433

About Time

zack9433 發表在 痞客邦 留言(0) 人氣(159)