我无法在 UI-Select 中访问选定的下拉值,如何在 Controller 中访问选定的值?
<ui-select name="optionType" ng-model="optionType.selected" theme="bootstrap" append-to-body="true" reset-search-input="true">
<ui-select-match placeholder="Option">
<span ng-bind-html="ctrl.trustAsHtml($select.selected.type)"></span>
</ui-select-match>
<ui-select-choices repeat="option in optionTypes | filter: $select.search" position="down">
<span ng-bind-html="ctrl.trustAsHtml(option.type) | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
Controller :
$scope.optionType = {};
$scope.optionTypes =
[
{type: "Risk Reversal"},
{type: "Straddle"},
{type: "Strangle"},
{type: "Spread"},
{type: "VANILLA"}
]
最佳答案
检查他们的“对象作为源”example
你需要像这样绑定(bind)它来重复:
<ui-select-choices repeat="item.type as item in optionTypes">
关于javascript - 如何访问 UI-SELECT 下拉值 [AngularJS 1.4.7],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46824010/