的package.json由於它不是「輸入」的已知屬性,因此無法綁定到「ngModule」。在角2 asp.net核心
{
"version": "1.0.0",
"name": "asp.net",
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@angular/upgrade": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20"
},
"devDependencies": {
}
}
這是app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { LoginComponent } from "./Components/login.Component";
@NgModule({
imports: [BrowserModule, FormsModule],
declarations: [LoginComponent],
bootstrap: [LoginComponent]
})
export class AppModule { }
我有進口FormsModule在app.module但還是我面對這個問題。
這是login.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'login-app',
templateUrl: 'Home/partialLogin'
})
export class LoginComponent {
email: string;
password: string;
constructor() {
this.email = "[email protected]";
this.password = "test anand";
}
login(event) {
console.log(this.email);
event.preventDefault();
}
}
login.cshtml
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="text" class="form-control" name="email" [(ngModule)] ="email" placeholder="username or email">
</div>
我有谷歌它的解決方案。他們提到的任何地方都會導入我已經添加的formModule,但仍然面臨着這個問題。
請任何人都可以解決這個問題。
它應該是'ngModel'不'ngModule' – Satpal