I am using ui-select2 in angularjs which uses select2 plugin of jquery. I have some pre-defined list and then when i start searching for anything and if that is not found in list i want to add a new value. I am doing something like this :
var selectOptions = {
formatNoMatches: function(term) {
return "<a ng-click=\"addCountry('abc');\">Add new country</a>";
}
};
$scope.addCountry = function(countryName) {
console.log (' test');
};
But the click doesnt work and the console in addCountry is never printed. Any idea how to add new option for ui-select2 in angular js ?