Kha Tran Kha Tran - 3 months ago 751
AngularJS Question

Angular2: ngModule, BrowserModule, FormsModule are not exported members

I am going through the Angular2 tutorial at
https://angular.io/docs/ts/latest/tutorial/toh-pt5.html. All good to step Routing. Visual Studio Code shows the error at first 03 lines:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';


as

[ts]
Module '"c:/Users/ktran/Source/Repos/angular2-quickstart-ts/node_modules/@angular/core/index"' has no exported member 'NgModule'.


folder node_modules:

enter image description here

any idea please?

Answer

Some module just add to the new version of Angular, so if you not update, you can not import it.

After 30 minutes search, my solution:

Create a new folder, go to your folder.

In command line, Type:

 git clone  https://github.com/angular/quickstart
 cd quickstart
 npm install

And copy your old code to the new create project