Winkel-2: Template-parsing-Fehler: Can ' T bind to 'ngModel' da ist es nicht eine bekannte Eigenschaft von 'Eingabe'

Bekam ich diese Meldung, wenn ich die zwei-Wege-Bindung [(ngModel)]

Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'.

Verstehe ich, dass der Import der FormsModule wird angenommen, um dieses Problem zu beheben, wie viele Menschen hier sind. Ich habe jedoch, hatte die FormsModule importiert, aber es hilft nicht, Problem immer noch da sein

Jeden Fall ist es etwas anderes falsch mit meinem code. Können Sie werfen ein Licht.
Hier ist meine app.- Modul.ts

JS:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule, Routes } from '@angular/router';

import { ValidationModule } from './validation/validation.module';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app.module.routing';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    ValidationModule,
    AppRoutingModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { 

}

hier ist meine app.routing.- Modul.ts

JS:

import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'

import { Home1Component } from './home1.component';
import { Home2Component } from './home2.component';

const appRoutes = [
  { path: 'home1', component: Home1Component },
  { path: 'home2', component: Home2Component },
  { path: 'validation', loadChildren: './validation/validation.module#ValidationModule'}
];

@NgModule({
    declarations:[
        Home1Component,
        Home2Component
    ],
    imports: [
        RouterModule.forRoot(appRoutes)
    ],
    exports:[
        RouterModule
    ]
})

export class AppRoutingModule {

}

und hier ist mein html

HTML:

<h1> home 1 </h1>
<form>
    <input [(ngModel)]="currentHero.name">
    <button type="button" (click)="onOkClicked()">Ok</button>
</form>

Lege ich meinen source-code hier, ich bin mit Winkel-cli
Quelle

InformationsquelleAutor khoailang | 2017-02-22
Schreibe einen Kommentar