Some inputs inside ng-switch don't update the model when changed #1139
Comments
@racheldale This works as intended. The |
Yes you are right. ng-switch creates a new scope and so ng-model is writing to an inner scope value and the outer scope value does not get updated. As you say, use objects to refer to the field. |
Here is the modified working fiddle for the pragmatic people out there: http://jsfiddle.net/MrFusion/r4RKW/36/ |
Hi, I am having this problem, however, I need to bind the ngModel from the parent. How can I bind the model and still uses ng-switch in this case? |
@jodinathan - if you provide a plunker (or similar) of your situation you are more likely to get a solution. It is difficult to help with just a description. |
@petebacondarwin , here it is thanks |
You should not be passing |
Hi @petebacondarwin , I fixed your JSBIN: http://jsbin.com/behome/edit?html,js,output for anyone that comes here. |
Inputs that point to fields directly on the scope (e.g. data-ng-model="fieldName") don't update when inside of an ng-switch case. This works fine for fields that are inside an object (e.g. data-ng-model="item.fieldName").
Here is an example: http://jsfiddle.net/r4RKW/1/
The text was updated successfully, but these errors were encountered: