我想使用uib-popover为选项框的ng-options生成的选项创建弹出/工具提示。我尝试了两种方法,但两种方法都不够好。 Ng-options运行良好,因为我必须选择一个默认项目,但我无法弄清楚如何插入uib-popover。如果我使用ng-repeat,我觉得我可以更好地控制每个选项的生成方式,但我无法确定如何为该场景选择defualt项目。这是我用于ng-repeat方法的代码:
(function() {
"use strict";
var selectionTestViewModel = function() {
var vm = this;
vm.options = [
{ id: 1, val: "Option 1", desc: "Description of Option 1" },
{ id: 2, val: "Option 2", desc: "Description of Option 2" }
];
vm.selectedOption = vm.options[0];
};
angular.module("angularApp").controller("selectionTestController", [selectionTestViewModel]);
}());

<div class="page-content" ng-controller="selectionTestController as st">
<h2>Selection Test</h2>
<div>
<select ng-model="st.selectedOption">
<option ng-repeat="op in st.options track by op.id" value="{{op.id}}" title="{{op.desc}}">{{op.val}}</option>
</select>
<div>
<span>Selected Value: {{st.selectedOption}}</span>
</div>
</div>
</div>
&#13;