I am creating an Angular application and I am starting to use some elements of the Kendo UI interface. I'm having trouble connecting an AutoComplete control. I would like to use a factory that will return a list of "auto complete" values ββfrom my database.
I have automatic full control enabled, and I'm trying to use the k-options attribute:
<input kendo-auto-complete ng-model="myFruit" k-options="FruitAutoComplete" />
The following hard list of fruits works in my controller:
$scope.FruitAutoComplete = { dataTextField: 'Name', dataSource:[ { id: 1, Name: "Apples" }, { id: 2, Name: "Oranges" } ] }
When I switch to using my factory, I see that it calls and returns data from the factory, but never gets attached to the screen.
$scope.FruitAutoComplete = { dataTextField: 'Name', dataSource: new kendo.data.DataSource({ transport: { read: function () { return FruitFactory.getYummyFruit($scope.myFruit); } } }) }
As a result, I get a request that never runs to complete the auto. 
My factory just returns an array of fruits [my Fruit factory Code:
getYummyFruit: function (val) { return $http.get('api/getFruitList/' + val) .then(function (res) { var fruits= []; angular.forEach(res.data, function (item) { fruits.push(item); }); return fruits; }); }
source share