How to update k-ng-model (aka two-way binding as with ng-model)

Does Kendo support k-ng-modeltwo-way binding, and if not, what is the best approach to simulate it?


A bit of context:

In angular, when the update for the ng model is complete, all interested parties are updated (for example, the view is updated). In kendo, when using the k-ng model, I cannot find a way to do the same where I would like to directly set the value from the controller / directive.

Here is an example: Dojo coding

And, just in case, the code:

 <input kendo-auto-complete 
        k-ng-model="vm.kendoSelection" 
        ng-model="vm.angularSelection"                     
        k-data-source="vm.countryNames" 
        k-data-value-field="'name'"
        k-data-text-field="'name'" />

Sample Controller:

  angular.module("MyApp", [ "kendo.directives" ])
         .controller("Controller", function(){                  
             // just some data source
             this.countryNames = [
                { name: "Albania" },
                { name: "Andorra" }
              ];

             // how to set the k-ng-model here, so that it is also propagated properly (like on 
             // the view, and that other events like k-on-change work)?
             this.kendoSelection = { name: "Albania" };                  
          });

EDIT:

Even after the answer of Dion Dirza, k-on-change does not shoot (although this solution is in a good direction)

Example with k-on-change

Dion Deers

+4
source share
1

, k-ng-model . , kendoSelection , , .

vm.kendoSelection = [{ name: "Albania" }];

, . , , widget data-value-field, .

+3

All Articles