Enlace del valor en un área de texto
Estoy tratando de hacer el enlace bidireccional más simple en Angular2. Me gustaría compartir una variable entre mi componente y su plantilla.
Mi plantilla es:
<textarea [(ngModel)]="currentQuery"></textarea>
Y mi componente es:
import { Component } from '@angular/core';
import { ViewChild } from '@angular/core';
import { OnInit } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'vs-home',
templateUrl: 'home.component.html'
})
export class HomeComponent {
private currentQuery: string = '';
}
Según los documentos, esto debería funcionar, pero estoy obteniendo:
Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'textarea'. ("
<div class="query-bar-container">
<textarea [ERROR ->][(ngModel)]="currentQuery"></textarea>
<!-- <button type="button" class="btn btn-default" (click"): HomeComponent@2:15