简体   繁体   English

无法绑定到“ ngModel”,因为它不是“ input”的已知属性。 (“ =” col-md-4控制标签“为=” idNome“> Nome:

[英]Can't bind to 'ngModel' since it isn't a known property of 'input'. (“=”col-md-4 control-label“ for=”idNome">Nome: </label>

Can't bind to 'ngModel' since it isn't a known property of 'input'. 无法绑定到“ ngModel”,因为它不是“ input”的已知属性。 ("="col-md-4 control-label" for="idNome">Nome: (“ =” col-md-4 control-label“ for =” idNome“> Nome:

app.module.ts: app.module.ts:

 import { FormsModule }   from '@angular/forms';
   @NgModule({
  declarations: [ AppComponent], 
  imports: [
   ...
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

a app-routing.module.ts: 一个app-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 { }

a atendimento.module.ts: 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 { }

and atendimento.component.ts: 和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 {

you need to add FormsModule to the a atendimento.module.ts as well, since your component is a part of AtendimentoModule 您还需要将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 { }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法绑定到“ngModel”,因为它不是“输入”的已知属性 - Can't bind to 'ngModel' since it isn't a known property of 'input' 错误:无法绑定到“ ngModel”,因为它不是的已知属性 - Error: Can't bind to 'ngModel' since it isn't a known property of 无法绑定到“ngModel”,因为它不是“输入”的已知属性,如何在 angular 9 中修复? - Can't bind to 'ngModel' since it isn't a known property of 'input', how to fix in angular 9? 无法绑定到((ngModel),因为在角度单位测试用例中它不是&#39;input&#39;的已知属性 - Can't bind to '(ngModel' since it isn't a known property of 'input' in angular unit test case 无法绑定到“控件”,因为它不是(myComponent)的已知属性 - Can't bind to 'control' since it isn't a known property of (myComponent) Ant - 无法绑定到“ngModel”,因为它不是“nz-switch”的已知属性 - Ant - Can't bind to 'ngModel' since it isn't a known property of 'nz-switch' 无法绑定到“appIfRoles”,因为它不是“p”的已知属性 - Can't bind to 'appIfRoles' since it isn't a known property of 'p' 无法绑定到“ chartType”,因为它不是“ canvas”的已知属性 - Can't bind to 'chartType' since it isn't a known property of 'canvas' 无法绑定到“已禁用”,因为它不是&#39; <button>&#39;</button>的已知属性 - Can't bind to 'disabled' since it isn't a known property of '<button>' 无法绑定到“highlight”,因为它不是“code”的已知属性 - Can't bind to 'highlight' since it isn't a known property of 'code'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM