无法绑定到 'ngModel',因为它不是 'input' 的已知 属性。 ("="col-md-4 control-label" for="idNome">姓名: </label>
Can't bind to 'ngModel' since it isn't a known property of 'input'. ("="col-md-4 control-label" for="idNome">Nome: </label>
无法绑定到 'ngModel',因为它不是 'input' 的已知 属性。 ("="col-md-4 control-label" for="idNome">姓名:
app.module.ts:
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [ AppComponent],
imports: [
...
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
一个应用-routing.module.ts:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes), ],
exports: [RouterModule]
})
export class AppRoutingModule { }
一个atendimento.module.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AtendimentoRoutingModule } from './atendimento-routing.module';
import { AtendimentoComponent } from './atendimento/atendimento.component';
@NgModule({
imports: [
CommonModule,
AtendimentoRoutingModule
],
declarations: [AtendimentoComponent]
})
export class AtendimentoModule { }
和atendimento.component.ts:
import { Component, OnInit } from '@angular/core';
import { AtendimentoService } from '../atendimento.service';
import { Cliente } from '../../cliente/Cliente'
@Component({
selector: 'app-atendimento',
templateUrl: './atendimento.component.html',
styleUrls: ['./atendimento.component.css'],
providers: [AtendimentoService, Cliente]
})
export class AtendimentoComponent implements OnInit {
您还需要将 FormsModule
添加到 atendimento.module.ts
中,因为您的组件是AtendimentoModule
的一部分
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AtendimentoRoutingModule } from './atendimento-routing.module';
import { AtendimentoComponent } from './atendimento/atendimento.component';
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
CommonModule,
AtendimentoRoutingModule,
FormsModule
],
declarations: [AtendimentoComponent]
})
export class AtendimentoModule { }
无法绑定到 'ngModel',因为它不是 'input' 的已知 属性。 ("="col-md-4 control-label" for="idNome">姓名:
app.module.ts:
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [ AppComponent],
imports: [
...
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
一个应用-routing.module.ts:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes), ],
exports: [RouterModule]
})
export class AppRoutingModule { }
一个atendimento.module.ts:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AtendimentoRoutingModule } from './atendimento-routing.module';
import { AtendimentoComponent } from './atendimento/atendimento.component';
@NgModule({
imports: [
CommonModule,
AtendimentoRoutingModule
],
declarations: [AtendimentoComponent]
})
export class AtendimentoModule { }
和atendimento.component.ts:
import { Component, OnInit } from '@angular/core';
import { AtendimentoService } from '../atendimento.service';
import { Cliente } from '../../cliente/Cliente'
@Component({
selector: 'app-atendimento',
templateUrl: './atendimento.component.html',
styleUrls: ['./atendimento.component.css'],
providers: [AtendimentoService, Cliente]
})
export class AtendimentoComponent implements OnInit {
您还需要将 FormsModule
添加到 atendimento.module.ts
中,因为您的组件是AtendimentoModule
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AtendimentoRoutingModule } from './atendimento-routing.module';
import { AtendimentoComponent } from './atendimento/atendimento.component';
import { FormsModule } from '@angular/forms';
@NgModule({
imports: [
CommonModule,
AtendimentoRoutingModule,
FormsModule
],
declarations: [AtendimentoComponent]
})
export class AtendimentoModule { }