นี่คือซอแสดงปัญหา http://jsfiddle.net/Erk4V/1/
มันจะปรากฏขึ้นหากฉันมี ng-model ภายใน ng-if โมเดลนั้นไม่ทำงานตามที่คาดไว้
ฉันสงสัยว่านี่เป็นข้อผิดพลาดหรือหากฉันเข้าใจผิดเกี่ยวกับการใช้งานที่เหมาะสม
<div ng-app >
<div ng-controller="main">
Test A: {{testa}}<br />
Test B: {{testb}}<br />
Test C: {{testc}}<br />
<div>
testa (without ng-if): <input type="checkbox" ng-model="testa" />
</div>
<div ng-if="!testa">
testb (with ng-if): <input type="checkbox" ng-model="testb" />
</div>
<div ng-if="!someothervar">
testc (with ng-if): <input type="checkbox" ng-model="testc" />
</div>
</div>
</div>
controllerAs
?
scope:false
และฉันเพิ่มng-if
องค์ประกอบรอบคำสั่ง - ขอบเขตถูกผูกไว้ในตอนแรก แต่พวกเขาก็แยกออกจากกันหลังจากเฝ้าดูการปรับปรุงหนึ่งในค่าขอบเขต ...