如何使用ng-option / ng-repeat在select选项上应用title / tooltip / popover

问题描述 投票:0回答:1

我想在select标签的选项上动态应用popover不在select标签上,但是这里的选项是我的代码

您可以进一步参考我需要应用工具提示的代码

<select class="form-control" ng-model="selectedCategory2" id="category" style="width:280px;" name="category" ng-change="onselectedchange2(selectedCategory2,DomainLoginId,selectedCategory3)" popover="{{allow}}" popover-trigger="mouseenter" popover-placement="right required>
    <option ng-repeat=" item in groupData" value="{{item.sso_access_type}}" title="{{allow}}">{{item.sso_access_type}}</option>
</select>

根据这段代码,我在Firefox中得到的输出是

<option ng-repeat=" item in groupData" value="S_Adv-Type6" title="Read-Only Access, S Budgets , S Billing" class="ng-binding ng-scope">S_Adv-Type6</option>

<option ng-repeat=" item in groupData" value="S_Adv-Type6" title="Read-Only Access, S Budgets , S Billing" class="ng-binding ng-scope">S_Adv-Type6</option>

您可以看到两个选项的标题变得相同,我希望它与控制器中的不同。

下面是我想要的图片链接1:https://i.stack.imgur.com/P32Zl.jpg

javascript html angularjs
1个回答
0
投票

在groupData的每个项目中设置允许键

$scope.groupData = [
    {sso_access_type = 'one' , allow:'allowOne'},
    {sso_access_type = 'tow' , allow:'allowTow'}
];

并设置这样的选项

<option ng-repeat=" item in groupData" value="{{item.sso_access_type}}" title="{{item.allow}}">{{item.sso_access_type}}</option>
© www.soinside.com 2019 - 2024. All rights reserved.