【问题标题】:Not able to update the model with Angular UI and Modal无法使用 Angular UI 和 Modal 更新模型
【发布时间】:2017-04-24 11:45:46
【问题描述】:

我正在使用 angular 和 Bootstrap 用于 angular (angular UI),当我打开模式(单击编辑列表)并选择要编辑的国家/地区时,假设我更改了国家/地区的名称,我没有看不到它反映在模态控制器的模型中。所以这个值不会更新:$ctrl.Country。

我在输入文本中使用双重绑定时迷路了:{{$ctrl.Country.Name}}

这是我的小伙伴

<a href="https://plnkr.co/edit/5JHKpdmLMVBFlmL22SGC?p=preview">Plunker</a> 

谢谢

【问题讨论】:

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


    【解决方案1】:

    试试这个plunkr 修复了一些错误:

    1. <input type="text" class="form-control" ng-model="$ctrl.Country.Code">&lt;input type="text" class="form-control" ng-model="$ctrl.Country.Code"&gt;: ng-model 而不是 value
    2. $ctrl.Save 已添加:

    3. modalInstance.result.then:逻辑已修复

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-10
      • 2020-01-08
      • 2016-09-15
      相关资源
      最近更新 更多