嗨,我的用户界面中有一个日历
<select id="selectDuration" name="selectDuration" required ui-
select2="select2DurationSettings" ng-model="duration" ng-
change="loadSensoryEvents()">
此持续时间值未更新
这是我的 JS 文件
if(filterStateService.getQuery()){
filterStateService.setDefaultDuration(filterStateService.getDefaultDuration());
$scope.duration = filterStateService.getDefaultDuration();
}
我正在更新此 $scope.duration 值,但该值未在我的 UI 中更新。
最佳答案
在 Controller 中使用对象并声明对象
$scope.selected = {};
HTML
<select id="selectDuration" name="selectDuration" required ui-
select2="select2DurationSettings" ng-model="selected.duration" ng-
change="loadSensoryEvents()">
关于javascript - AngularJS:ng-model 没有在 UI 中更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44967953/