当ng-model改变时,Angularjs选择视图不更新

时间:2016-02-04 04:21:56

标签: javascript html angularjs

我有这样的观点

<select id="cooperatorId2" class="form-control mars-form-control" name="cooperatorId" required
                        ng-model="selectedCooperator" ng-options="item as item.name group by 'Cooperator' for item in userCooperators" ng-change="cooperatorChanged(selectedCooperator)" ng-disabled="!userCooperators.length > 0 || !showCooperator">
                </select>

并在我的控制器上

$scope.cooperatorChanged = function (item) {
    $scope.selectedCooperator = item;
    //resetBookmark();
};

$scope.$watch("form.cooperatorId", function(newValue, oldValue){
    $scope.cooperatorChanged(_.find($scope.userCooperators, {'id': newValue}));

});

当$ scope。$ watch work,它找到要更新的正确项目,但查看不更新

请有人帮助我,谢谢

0 个答案:

没有答案