【问题标题】:select ng-model sometimes not updating on change event选择 ng-model 有时不会在更改事件上更新
【发布时间】:2015-12-18 07:38:42
【问题描述】:

我正在使用 Angular chosen-select,并对其进行了自定义以启用动态加载,即。从服务器加载数据。

当我取消选择一个值时,它会从选定的项目中删除它,但它不会更新ng-model。但这在 IE 中运行良好,但我可以在 chrome 和 Mozilla 中看到问题。我猜这与更改事件有关。

【问题讨论】:

  • 你应该显示一些代码
  • 请提供演示代码.. 没有任何代码就像在黑暗中拍摄一样。

标签: jquery angularjs google-chrome angularjs-ng-model


【解决方案1】:
function Ctrl($scope) {
    $scope.message = "Waiting 2000ms for update";

    setTimeout(function () {
        $scope.$apply(function () {
            $scope.message = "Timeout called!";
        });
    }, 2000);
}

【讨论】:

    猜你喜欢
    • 2014-07-17
    • 2014-11-30
    • 2018-03-02
    • 2023-03-26
    • 2017-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多