0

In my current project, I have an input which is a kendo-auto-complete element. I have a category data source and when I type the categories will be visible from where I can select. Also I can type a new category name in the text box and enter, it'll be added to the categories. I have a bug when I added a new category and then when I select an existing category from the auto complete, only 1 or 2 characters being added to the category.

This is my html element

<form ng-submit="addCategory(categoryInput)">
<input id="category" type="text" kendo-auto-complete ng-model="categoryInput" k-data-source="categories"/>
</form>

In the controller

$scope.addCategory = function(category) {
    $scope.cCategories.push(category);
    $scope.categoryInput = "";
};  

Requirement:

After adding a new category, and when selected an existing category from the autocomplete list, the whole text must be added

Mujahid
  • 1,227
  • 5
  • 32
  • 62
  • console log the category input value in the controller – avck Jul 14 '16 at 04:56
  • I don't know what you're trying to do, but you already have the *categoryInput* parameter that you're sending to your *addCategory()*. It's redundant, you can simply use -> `$scope.cCategories.push($scope.categoryInput);` – developer033 Jul 14 '16 at 05:05
  • @avck I did, it only takes whatever the characters I typed to filter, not the whole word – Mujahid Jul 14 '16 at 05:48

0 Answers0