【问题标题】:AngularJS: ng-model not getting updated in UIAngularJS:ng-model 未在 UI 中更新
【发布时间】:2017-07-07 09:59:21
【问题描述】:

嗨,我的 UI 中有一个日历

     <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();  
         }    

M 正在更新此 $scope.duration 值,但此值未在我的 UI 中更新。

【问题讨论】:

    标签: javascript html angularjs calendar


    【解决方案1】:

    在控制器中使用对象并声明对象

    $scope.selected = {};
    

    HTML

    <select id="selectDuration" name="selectDuration" required ui-
     select2="select2DurationSettings" ng-model="selected.duration" ng-
    change="loadSensoryEvents()">
    

    【讨论】:

      猜你喜欢
      • 2016-03-21
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 1970-01-01
      • 1970-01-01
      • 2016-01-02
      • 2015-03-16
      相关资源
      最近更新 更多