Webshim with Angularjs
Webshim和Angularjs合用的时候,遇到Angularjs动态生成节点时会有bug,比如ngSwitch内的 input 使用 placeholder ,会导致 scope 出现问题从而ngModel无法按预期行动。
解决办法是在新节点生成后调用Webshim的 updatePolyfill
方法:
# coffeescript
angular.module('components')
# 修复WSpalceholder与ngModel的冲突
.directive('placeholder',->
{
restrict: 'A'
link: ($scope,$elm,$attrs,ngModel)->
$elm.updatePolyfill()
}
)
参考:Dynamically adding HTML5 markup
blog comments powered by Disqus
Published
13 November 2013