I've created a new angular2 application using the angular-cli. Now I was trying to get the data from an API using HTTP. The code I've written:
movies.service.ts
import { Injectable } from '@angular/core';
import { Movie } from './movie';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/Rx';
My atom editor gives error on @angular/http line. So, I've manually installed angular2 using npm install angular2 on my project folder and then modify that error generated line like this:
import { Http, Response } from 'angular2/http';
BUt now my console is showing:
"NetworkError: 404 Not Found - http://localhost:4200/angular2/http/index.js"
I've added in my index.html page the following script:
<script src="https://code.angularjs.org/2.0.0-beta.17/http.dev.js"></script>
and in my package.json files dependencies "angular2": "2.0.0-beta.17",.
still the same error.
Anyone have any clue? I'm a newbie in angular2. So, any help or suggestion is highly appreciated.