简体   繁体   English

角度选择:所选值不会立即显示

[英]Angular-chosen: selected value not displayed immediately

I'm using angular-chosen in my angular application. 我在角度应用程序中使用了angular-chosen I have in a modal, different inputs and a select chosen . 我有一个模态,不同的输入和select chosen The modal let the user add or edit person's informations. 模式允许用户添加或编辑人的信息。 My problem is that in the edit mode, the selected value of the chosen is not displayed at the first time. 我的问题是,在编辑模式中,所述的所选择的值chosen不是在第一次显示。 It's just when I reopen the modal that I can see the selected value. 只有当我重新打开模态时,我才能看到所选的值。 I verified if the data takes too much time to be loaded, but it seems like it's a problem with the chosen and the modal. 我验证了数据是否花费太多时间来加载,但似乎与选择的模式和模态有关。 This is how I display it: 这是我的显示方式:

 <select id="school" name="school" 
   no-results-text="'No data'" chosen
     disable-search-threshold="1" ng-model="person.school"
     ng-options="school as school.name + ' - ' + school.districtName + ' - ' + school.regionName  + ' - ' + school.cityName  for school in schools track by school.id">
          <option value="">&nbsp;</option>
   </select>

您必须从控制器启动它,因为ng-model是未定义的 ,没有''或您要选择person.school = ''或者可能是在ng-init="person.school = ''"中选择的标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM