0
私は2番めに新しいです。自分のコンポーネントの変数をビューの入力から更新しようとしています。私の入力を変数にバインドする方法がわからないのですか?おかげ角2のデータバインディング
私は2番めに新しいです。自分のコンポーネントの変数をビューの入力から更新しようとしています。私の入力を変数にバインドする方法がわからないのですか?おかげ角2のデータバインディング
私は最も簡単な方法は、あなたのコンポーネントに続いて
<input type="text" [(ngModel)]="yourVariable" />
ngModel
を使用することだと思う、あなたはより多くの情報については、変数「yourVariable」import { Component } from '@angular/core';
@Component({
selector: 'my-cool-app',
templateUrl: './something.html',
styleUrls: ['./something.css']
})
export class TimeSliderComponent {
private yourVariable: string;
constructor() { }
}
を作ることができ、チェックアウト: をhttps://angular.io/docs/ts/latest/api/forms/index/NgModel-directive.html
ここは私の見解です。 – Gary
http://stackoverflow.com/questions/31623879/angular-2-two-way-binding-using-ng-model-is-not-working –
https://angular.io/docs/ts/latest/cookbook/component-communication.html –