How to get the entereed text which is entered in textbox while adding new item.
sharathm89 opened this issue · 2 comments
sharathm89 commented
<div custom-select="g for g in growable | filter: $searchTerm" ng-model="custom1" custom-select-options="growableOptions">
</div>
As shown in the above code which is found in the examples.
How to retrieve text which is entered in textbox when adding a new item.
In the example code hardcoded item is being created rather which is entered. So how to get the entered text.
$scope.growable = ['Item 1', 'Item 2', 'Item 3'];
$scope.growableOptions = {
addText: 'Add new item',
onAdd: function () {
var newItem = 'Item ' + ($scope.growable.length + 1);
$scope.growable.push(newItem);
return newItem;
}
};
axel-zarate commented
It may sound silly but, as I haven't really used that feature I never thought of this simple thing. Anyway, it's fixed on this commit. Now, the text inside the search box is passed as the only parameter to the onAdd
function.
sharathm1 commented
thanks