我的组件文件包含:
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<user></user>
`,
})
export class AppComponent {
}
我的app.modules:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angluar/forms';
import { AppComponent } from './app.component';
import { UserComponent } from './components/user.component';
@NgModule({
imports: [ BrowserModule ,FormsModule],
declarations: [ AppComponent, UserComponent],
bootstrap: [ AppComponent ]
})
export class AppModule { }
当我尝试编译我的代码时出现此错误:错误TS2307:找不到模块'angular2 / forms' 谢谢!
答案 0 :(得分:2)
angular
中有拼写错误:import { FormsModule } from '@angluar/forms';
应该是:
import { FormsModule } from '@angular/forms';
答案 1 :(得分:-1)
您的代码中有错误 在这里查看新的:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { UserComponent } from './components/user.component';
@NgModule({
imports: [ BrowserModule ,FormsModule],
declarations: [ AppComponent, UserComponent],
bootstrap: [ AppComponent ]
})
export class AppModule { }
&#13;