I have a repeating Autocomplete control througout an MVC web app I am building. I decided to use Kendo's Angular Autocomplete tool - because we also use their calendar and dropdownlist controls (FYI - handy for large lists - as allows a search within the dropdown). And we are also using Angular.
I have got the Autocomplete working and "auto-completing" from a directive. However, when you type or select a value in the autocomplete, it is not binding the model back to the parent controller. Im not an expert on directives so I would love some help if you can! Please see this plunker which has everything in it to replicate my test! http://plnkr.co/edit/Zlw75QhmF7xkrLKsQkP8?p=preview
The directive returns this:
return {
restrict: 'E',
scope: {
bindTo: '='
},
template: '<input kendo-auto-complete ng-model="vm.bindTo" k-options="vm.fruitAutoComplete" style="width: 100%;"/>',
controllerAs: 'vm',
controller: fruitAutocompleteCtrl,
bindToController: true
};
And on the html I declare this:
<fruit-autocomplete bindTo="vm.selectedFruit"></fruit-autocomplete>
Bascialy, I am trying to get the value of the autocomplete directive to bind to the "vm.selectedFruit" variable on the controller. Any help is really appreciated!
Thanks in advance!