Bootstrap工具提示选择选项不起作用

时间:2017-02-20 07:11:31

标签: javascript html angularjs twitter-bootstrap twitter-bootstrap-tooltip

我需要为选择框中的每个选项显示工具提示

 <select ng-model="rightList" class="form-control" size="13" multiple>
            <option 
                ng-repeat="item in selectedList" 
                value="{{$index}}" 
                uib-tooltip="See? Now click away..."
                tooltip-placement="right">
                {{item.name}}
            </option>
  </select>

请帮忙。

2 个答案:

答案 0 :(得分:0)

请尝试以下代码:

JS(控制器中的数据):

$scope.selectedList = [{
      id: 1,
      name: 'name1',
      toolTip:'tooltip one'
    }, {
      id: 2,
      name: 'name2',
      toolTip:'tooltip two'
    }, {
      id: 3,
      name: 'name3',
      toolTip:'tooltip three'
    }];

<强> HTML:

<select>
 <option  
     data-toggle="tooltip" 
     data-placement="right" 
     title="{{item.toolTip}}" 
     ng-repeat="item in selectedList" 
     value="{{$index}}"> 
     {{item.name}}
 </option> 
</select>

答案 1 :(得分:-1)

将工具提示值保留在标题中。 EX:

<select size="5" ng-model="displayTags">
<option  ng-repeat="tag in tags | filter:searchTags">
<span title="tag.tagName">{{tag.tagName}}</span>    </option>
</select>
相关问题