Currently, I am using the typeahead feature from angular-ui-bootstrap to allow users to select a person's name or add a new name if it is not available in the options.
I have customized the getMatchesAsync
function with the following code:
if(scope.matches.length < 4 || scope.matches.length == undefined){
scope.matches.push({
id: getMatchId(matches.length),
label: 'Add New +',
model: 'new'
});
}
However, I understand that this is not a sustainable solution, especially when the component is updated.
Where should I place this code and how can I effectively integrate it into the component? Typeahead module: https://github.com/angular-ui/bootstrap/blob/master/src/typeahead/typeahead.js