Estou fazendo um formulário, porem quando tento executar o form gera o erro abaixo Já tentei todas as formas, preciso de um help Obrigado
Unhandled Promise rejection: Template parse errors:
Can't bind to 'ngModel' since it isn't a known property of 'input'. (" for="nome">Nome</label>
<input type="text" class="form-control" name="nome" id="nome" [ERROR ->][(ngModel)]="aluno.nome">
</div>
ConcentradoModule { }
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ConcentradoComponent } from './concentrado.component';
import { ConcentradoService } from '../services/concentrado.service';
@NgModule({
imports: [
CommonModule
],
declarations: [ConcentradoComponent],
exports: [ConcentradoComponent],
providers: [ConcentradoService]
})
export class ConcentradoModule { }
ConcentradoComponent
import { Component, OnInit } from '@angular/core';
import { Concentrado } from '../models/concentrado';
import { Aluno } from '../models/aluno';
import { Curso } from '../models/curso';
@Component({
moduleId: module.id,
selector: 'concentrado',
templateUrl: './concentrado.component.html',
styleUrls: ['./concentrado.component.css']
})
export class ConcentradoComponent implements OnInit {
sucesso: boolean = false;
cursos: Curso[];
aluno: Aluno;
constructor() {
this.cursos = [
new Curso('angular2', 'Angular 2'),
new Curso('javascript', 'JavaScript')
];
this.aluno = new Aluno();
}
enviar(): void {
alert('teste');
console.log(this.aluno.nome);
this.sucesso = true;
}
debug(): string {
return JSON.stringify(this.aluno);
}
ngOnInit() {
}
}
AppModule { }
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import 'rxjs/add/operator/map';
import { CommonModule } from '@angular/common';
import { routing } from './app.routes'
import { AppComponent } from './app.component';
import { ConcentradoModule } from './concentrado/concentrado.module';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpModule,
routing,
ConcentradoModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class Aluno{
constructor(
public nome?: string,
public email?: string,
public idade?: number,
public curso?: string){}
}
export class Curso{
constructor(
public codigo,
public nome){}
}