I have to make Login Page, but before I did it , I tried with simple HTTP get with JSON object. But the page does not load enter image description here
in some post I read that the arror (index):18 Error: (SystemJS) XHR error (404 Not Found) loading
can be solve if I write in index.html this line
<script src="node_modules/angular2/bundles/http.dev.js"></script>
, but it does not load. I tried
<script src="node_modules/@angular/bundles/http.dev.js"></script>
but nothing helped. In my imports I have @angular stead angular2
hier is my package.json
{ "name": "angular-quickstart", "version": "1.0.0", "scripts": { "start": "tsc && concurrently \\"tsc -w\\" \\"lite-server\\" ", "lite": "lite-server", "tsc": "tsc", "tsc:w": "tsc -w" }, "licenses": [ { "type": "MIT", "url": "https://github.com/angular/angular.io/blob/master/LICENSE" } ], "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", "@angular/core": "~2.2.0", "@angular/forms": "~2.2.0", "@angular/http": "~2.2.0", "@angular/platform-browser": "~2.2.0", "@angular/platform-browser-dynamic": "~2.2.0", "@angular/router": "~3.2.0", "@angular/upgrade": "~2.2.0", "angular-in-memory-web-api": "~0.1.15", "core-js": "^2.4.1", "reflect-metadata": "^0.1.8", "rxjs": "5.0.0-beta.12", "systemjs": "0.19.39", "zone.js": "^0.6.25" }, "devDependencies": { "@types/core-js": "^0.9.34", "@types/node": "^6.0.45", "concurrently": "^3.0.0", "lite-server": "^2.2.2", "typescript": "^2.0.3" } }
and my code https://gist.github.com/anonymous/d3b5f00ed5e9a5d3db603bf6eafb402f and https://gist.github.com/anonymous/d6940887480a6501a539fa15f8de6b9f
thanks much for your help
You need to import HttpModule
into your module.
app.module.ts
import { HttpModule } from '@angular/http'; // add this line
@NgModule({
imports: [
//....
HttpModule //make sure you import `HttpModule` into `NgModule`
],
// ...
)}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.