Two-way bind does not work if the model is something like ng-model="record.name" for Kendo UI Controls

Asked

Viewed 210 times

0

I have a problem with Kendo UI Controls

my HTML

 <input type="text" ng-model="record.name" kendo-numeric-text-box />
 <input type="text" ng-model="record.name"> </input>
 <button ng-click="resetRecord()" >test bind</button>

my test.js

$scope.record ={};
$scope.resetRecord= function(){
        $scope.record = {};
    }

When I run the function resetRecord only the default input clears its content, the Kendo UI input does not clear, I tried $scope.record =null but it doesn’t work either.

If I change the code below, it works, but I need it to work as above.

$scope.resetRecord= function(){
        $scope.record. name = null;
    }

This happens with all Kendo UI input, not only with Kendo-Numeric-text-box

If there is a way to interact with the object record, discovering all its properties, such as name worked for me.

My intention is only to have a controller for all system crud screens, I would not like to write a controller and model definition for each system entity.

Will be a bug?

1 answer

1

The solution is just to add the attribute k-rebind

<input type="text" ng-model="record.name" k-rebind="record.name" kendo-numeric-text-box /> 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.