Angular Can';t绑定到';ng型号';因为它不是';t'的已知属性;输入';
开始学习Angular 2,因为此错误尝试了堆栈溢出中的几乎所有链接,但仍然存在,请帮助我理解为什么即使在导入FormsModule之后仍然产生错误 这是我的customer.ts文件Angular Can';t绑定到';ng型号';因为它不是';t'的已知属性;输入';,angular,angular2-forms,Angular,Angular2 Forms,开始学习Angular 2,因为此错误尝试了堆栈溢出中的几乎所有链接,但仍然存在,请帮助我理解为什么即使在导入FormsModule之后仍然产生错误 这是我的customer.ts文件 export class Customer { public CustomerName: string = "asdsad"; public Code: string = "asdsa"; public Amount: string = "asdasd"; } app.component.ts i
export class Customer {
public CustomerName: string = "asdsad";
public Code: string = "asdsa";
public Amount: string = "asdasd";
}
app.component.ts
import { Component } from '@angular/core';
import { Customer } from "./Customer"
@Component({
selector: 'my-app',
moduleId: module.id,
templateUrl: './st.html'
})
export class AppComponent {
customerobj: Customer = new Customer();
}
app.module.ts
import { NgModule } from "@angular/core"
import { BrowserModule } from "@angular/platform-browser"
import { FormsModule } from '@angular/forms';
import { AppComponent } from "./app.component"
@NgModule({
imports: [BrowserModule, FormsModule ],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
梅因酒店
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"
import { AppModule } from "./app.module"
platformBrowserDynamic().bootstrapModule(AppModule);
我假设您使用的是ng模型,而不是ngModel 将其更改为ngModel 由于您尚未发布component.html 应该是,
<input [ngModel]="custoermerObj.Code"></input>
我假设您使用的是ng模型,而不是ngModel 将其更改为ngModel 由于您尚未发布component.html 应该是,
<input [ngModel]="custoermerObj.Code"></input>
您必须在输入标记中使用了“ng模型”
对于Angular2/4,使用ngModel
ng型号
用于角度1
ngModel
用于角度2
您必须在输入标记中使用了“ng模型”
对于Angular2/4,使用ngModel
ng型号
用于角度1
ngModel
用于angular 2使用[(ngModel)]
而不是[(ng model)]
使用[(ngModel)]
而不是[(ng model)]
发布您的HTML代码使用ngModel而不是ng model发布您的HTML代码使用ngModel而不是ng model这并没有提供问题的答案。若要评论或要求作者澄清,请在其帖子下方留下评论。-谢谢你的指导。谢谢你救了我很多。这并不能回答这个问题。若要评论或要求作者澄清,请在其帖子下方留下评论。-谢谢你的指导。谢谢你帮了我很多。谢谢你宝贵的时间。谢谢你宝贵的时间。谢谢你宝贵的时间。谢谢你宝贵的时间。