【发布时间】:2018-10-18 07:41:38
【问题描述】:
如果值匹配,则应自动选择选择选项
<input type ="text" class="form-control emailidinsert" dir-paginate="emails in emailarr | itemsPerPage:constidinfo.itemsPerPage" current-page="constidinfo.currentPage" total-items="total_count" value="{{emails.email_ids}}" >
这是我的文本字段,它具有用户电子邮件的值。
<select id="editunameto" class="form-control select" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-labelledby="select2-supplier_id-container" ng-options='unames as unames.email_id for emails in emailarr'>
<option value="0">--Select Username--</option>
<option ng-repeat="unames in usernames" value="{{unames.email_id}}">{{unames.username}}</option>
</select>
这是我的选择框,想要自动选择输入类型文本中的选项值,因为值应该与选择选项值匹配。我怎样才能实现我尝试使用 ng-options 但没有用
【问题讨论】:
-
您的控件中似乎缺少 ng-model 以将值绑定到 angularjs 元素。
-
@ImmanuelKirubaharanS 我在 select 中添加了 ng-model="usernames.email_id" ng-options='unames.email_id for unames in emailarr.email_ids' 但也没有显示
标签: php angularjs codeigniter angularjs-ng-repeat angularjs-ng-options