I have a multiple select
in a directive template and I want to customize the message that appears when no matches are found. The documentation on suggests overriding the formatNoMatches
method for this purpose.
This is the select
element in my directive's template:
<select ui-select2="select2Options" multiple>
<option ng-repeat="something in array">{{ something }}</option>
</select>
Here is what I added to the link
function in my directive's JS file:
...
link: function(scope, element, attributes) {
scope.select2Options = {
formatNoMatches: function(term) {
return 'custom message';
}
};
}
Despite setting it up as described above, the select
still shows 'No matches found' instead of 'custom message' when there are no options available. Can anyone help me figure out what's wrong? Thanks.