出於某種原因,綁定不上輸入ng-if
塊中的指令內輸入工作結合停止NG-如果
所以這個工作,不工作:
app.directive 'foo', ->
restrict: 'E'
scope:
type:'='
template: "<input ng-if=\"type === 'string'\" ng-model='filterText'>
<div> {{filterText}} </div>"
<foo type="'string'" />
它的工作原理罰款指令或沒有ng-if
罰款。用ng-if
包裝輸入裏面的div沒有幫助。這是一個錯誤嗎?
什麼是不工作?你的jsbin鏈接對我來說似乎很好。如果我將類型更改爲「測試」,則輸入隱藏。這不是你想要的嗎? – sma 2014-09-29 19:55:36
不,你會發現它沒有顯示{{filterText}}。如果您刪除NG-如果它工作的罰款 – Agzam 2014-09-29 19:56:20
可能重複[Angularjs NG的模型沒有在裏面工作NG-IF](http://stackoverflow.com/questions/18342917/angularjs-ng-model-doesnt-work -inside-ng-if) – zsong 2014-09-30 00:00:24