Ngoptions: Add Tooltip To Selection
using the following json collection: $scope.searchscope = [ { id: 0, name: 'Base', description: 'Search only the specified base object. The value is equal to 0.' }, { id: 1, name
Solution 1:
You would need a map from id
→ description
. One way to populate it would be:
$scope.idToDescription = null;
$scope.$watch("searchscope", function(newval) {
if( newval != null ) {
$scope.idToDescription = {};
var i;
for( i=0; i < newval.length; i++ ) {
$scope.idToDescription[newval[i].id] = newval[i].description;
}
}
});
And in your template use it as:
<select ...
title="{{ idToDescription[mySelections[0].SearchFilterMembershipsScope] }}">
Solution 2:
If you are using Twitter Bootstrap, you might also consider looking at Tooltips in UI Bootstrap and if you want fancier select boxes consider using ui-select2 based on Select2.
Post a Comment for "Ngoptions: Add Tooltip To Selection"