【发布时间】:2017-04-18 18:02:11
【问题描述】:
我正在使用引导多选控件。一旦 Angular 填充了所有选项,我需要在选择元素上执行 multiselect()。
这是绑定到 $scope 属性的选择框,在我看来,选项是从 accountInfo 对象数组 sn-p 生成的:
<select id="property" multiple="multiple"
ng-model="selectedProperty"
ng-options="account.property_name group by account.client_name for account in accountInfo">
</select>
所以一旦选项存在,我需要调用 $("#property").multiselect() 来生成引导控件,但我正在寻找一个事件来监听它告诉我何时生成了所有选项.
【问题讨论】:
-
您应该为此使用指令。另外,您确定
<select multiple="multiple">可以与ng-model和ng-options一起使用吗?我可以发誓我过去遇到过问题 -
ng-model 只要模型是一个数组,就可以与选择多个井一起工作 - 如何构建指令以确定何时写入最后一个选项?
标签: javascript angularjs twitter-bootstrap bootstrap-multiselect