Reputation: 19099
I crated the sample app using Augular CLI command. now trying to test the getting started application from https://angular.io/docs/ts/latest/guide/forms.html# sample code.
when I add these lines
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
its giving the below error message.
Module '"c:/shared/testngproj/node_modules/@angular/core/index"' has no exported member 'NgModule'.
import NgModule
How can import these three modules?
Here is my package.json file.
{
"name": "testngproj",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"postinstall": "typings install",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.2",
"es6-shim": "0.35.1",
"forms-angular": "^0.7.1",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.26",
"zone.js": "0.6.12"
},
"devDependencies": {
"angular-cli": "1.0.0-beta.10",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "1.3.1"
}
}
Thanks SR
Upvotes: 3
Views: 1436
Reputation: 55359
NgModule
was introduced in Angular 2 RC5, which was released a couple days ago, and the Angular documentation has since been updated to reflect the change.
Your package.json still references RC4 (2.0.0-rc.4), which doesn't have NgModule
. You will need to upgrade to RC5 (2.0.0-rc.5) to successfully follow the tutorial.
Upvotes: 3