【问题标题】:AngularUI Typeahead + Model value changeAngularUI Typeahead + 模型值更改
【发布时间】:2013-07-10 08:01:01
【问题描述】:

我有一个我建议城市的文本框。我已经使用了 angualar-ui typeahead 的建议。现在一切似乎都运行良好。

只是当我使用 $scope.cancel 通过角度重置表单时,它不会反映在 UI 上,而且模型似乎也没有重置为正确的值,因为表单似乎很脏。对于没有预先输入的字段,效果很好。

有人遇到过这个吗?

代码:

<input placeholder='City' type="text" ng-model="form.city" typeahead="x for x in suggestCity($viewValue)" />

function ContactController($scope, $http) {
    $scope.cancel = function() {
        $scope.form = angular.copy($scope.userprofile.contact);
    }
}

http://plnkr.co/edit/JuIuAXZQVsJlEzjM0faT?p=preview

【问题讨论】:

  • 能否分享您的完整 html 或小提琴代码
  • 编辑问题以添加 plnkr 代码

标签: angularjs angular-ui angular-ui-bootstrap


【解决方案1】:

好的,所以在http://angular-ui.github.io/bootstrap/的0.4.0版本中修复了一个错误

https://github.com/angular-ui/bootstrap/issues/591 中所做的更改也解决了您的问题。它尚未发布,但这里是来自持续集成服务器的版本的工作 plunk:

http://plnkr.co/edit/17UOgHJd82otwC6TS7s9?p=preview

【讨论】:

  • 非常感谢 :) 有没有办法让我得到修复?还是我应该等待发布?知道什么时候发布吗?
  • 您始终可以从 GitHub 存储库或 CI 服务器(plunker 中的链接)获取最新版本。下一个版本将在 3 周后发布。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多