当选择下拉列表更新时,ng-model不会更新

时间:2015-07-07 06:07:19

标签: javascript angularjs

我有一个动态的选择下拉列表,它位于ng-repeat内。

<span ng-if="checkValidityForDate(fields.secondaryAction[$index],fields.secondaryAction[$index].attributes[0].name,$index,fields.secondaryAction[$index].action.action_name) == true && flagForUniqueActionsDict[$index] == false" style="display:inline-block;" flex>
                    <input class="hidden" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-datatype" value="date"></input>
                    <select id="date" class="date-field" name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-date" ng-model="fields.secondaryAction[$index].attributes[0].filterModifier" style="margin: 10px;display:inline-block;"  ng-init="fields.secondaryAction[$index].attributes[0].filterModifier=(fields.secondaryAction[$index].action.action_name+'-is_between')" flex>
                       <option value="{{fields.secondaryAction[$index].action.action_name}}-is_between" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_between')">is between</option>
                       <option value="{{fields.secondaryAction[$index].action.action_name}}-is_less_than" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_less_than')">is less than</option>
                       <option value="{{fields.secondaryAction[$index].action.action_name}}-is_greater_than" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_greater_than')">is greater than</option>
                       <option value="{{fields.secondaryAction[$index].action.action_name}}-is_equal_to" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_equal_to')">is equal to</option>
                       <option value="{{fields.secondaryAction[$index].action.action_name}}-in_the_last" ng-selected="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-in_the_last')">in the last</option>
                    </select>
                    <span id="is_between" class="date-options" ng-if="fields.secondaryAction[$index].attributes[0].filterModifier==(fields.secondaryAction[$index].action.action_name+'-is_between')">
                       <!-- Test Begins -->
                       <span class="input-group ui-datepicker" style="margin-bottom: -14px;display:inline-block;" data-ng-controller="DatepickerDemoCtrl" flex>
                       <input type="text" 
                          class="form-control"
                          datepicker-popup="{{format}}"
                          id="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val1" 
                          name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val1"  ng-model="fields.secondaryAction[$index].attributes[0].filterValue" 
                          is-open="opened" 
                          datepicker-options="dateOptions" 
                          style="display:inline-block;width:120px;height:30px;"
                          close-text="Close"
                          ng-click="open($event)">
                       </span>
                       <span style="margin-left:10px;margin-right:10px;">and</span>
                       <span class="input-group ui-datepicker" style="margin-bottom: -14px;width:200px;display:inline-block;" data-ng-controller="DatepickerDemoCtrl" flex>
                       <input type="text" 
                          class="form-control"
                          datepicker-popup="{{format}}"
                          id="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val2" 
                          name="filter{{$index+1}}{{fields.secondaryAction[$index].action.action_name}}-is_between-val2"  ng-model="fields.secondaryAction[$index].attributes[0].filterValue1"
                          is-open="opened" 
                          datepicker-options="dateOptions" 
                          style="display:inline-block;width:120px;height:30px;"
                          close-text="Close"
                          ng-click="open($event)">
                       </span>
                       <!-- Test Ends -->
                    </span>

我的问题是 -

fields.secondaryAction[$index].action.action_name 更新时(来自不同的下拉列表),选择下拉列表的值会更新。

但是,ng-model fields.secondaryAction[$index].attributes[0].filterModifier 永远不会根据新值进行更新。

对此有何解决方案?

0 个答案:

没有答案