2017-02-09 50 views
0

我想修改數值文本框的值,但在更新它時會創建一個永不結束的循環。該模型綁定應低於kendo數字文本框ng模型綁定創建永無止境的循環

import { Component } from '@angular/core'; 
@Component({ 
    selector: 'my-app', 
    template: `<kendo-numerictextbox 
      [spinners]="showButtons" 
          [restrictDecimals]="true" 
          [round]="false" 
          [decimals]="decimals" 
          [format]="c2" 
          [ngModel]="value" 
          (ngModelChange)="onValueChange($event)"></kendo-numerictextbox> ` 
}) 
export class AppComponent { 
    public showButtons: boolean = false; 
    public format: string; 
    public decimals: number = 2; 
    public value: number = 0; 
    onValueChange(value: string) { 
     this.value = value + ' USD'; 
     alert(value); 
    } 
} 

連接plnkr更新一次

組件:http://plnkr.co/edit/kjl7e1wrFJGmpKa008cT

回答

0

注意,組件使用的數字只和要傳遞無效值。

+0

嘗試用這樣的數字this.value = value + 5;在給出的例子中,你會得到相同的結果 –

+0

看起來像一個錯誤。你可以在這裏提交https://github.com/telerik/kendo-angular – knikolov