Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular NgModule、BrowserModule和其他isn';在文件中不知道_Angular - Fatal编程技术网

Angular NgModule、BrowserModule和其他isn';在文件中不知道

Angular NgModule、BrowserModule和其他isn';在文件中不知道,angular,Angular,我正试图添加一个模块,如下所示(来自angular.io),但除了angular2应用程序中的AppComponent之外,我的文件名为app.module.ts import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component';

我正试图添加一个模块,如下所示(来自angular.io),但除了angular2应用程序中的AppComponent之外,我的文件名为
app.module.ts

    import { NgModule }      from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { AppComponent }  from './app.component';

    @NgModule({
      imports:      [ BrowserModule ],
      declarations: [ AppComponent ],
      bootstrap:    [ AppComponent ]
    })
    export class AppModule { }

我还需要从“@angular/Router”导入
import{Router,ActivatedRoute}或从angular.io导入的其他内容,但我无论如何都无法做到!Visual Studio代码为我的导入加下划线。我能做什么?我试图删除并再次安装npm,但没有成功。

请确保安装您的库:
npm install
@BougarfaouiElhoucine我确定已安装尝试使用
@angular/cli
创建项目@BougarfaouiElhoucine我一直在处理一个项目,但它没有app.module.ts文件,这就是为什么我要创建它。你能展示更多的代码和你的应用程序的结构吗