What is your setup (SystemJS? WebPack? something else?). If it is
SystemJS you need to include http bundle, see:
https://github.com/angular/angular/blob/master/modules/angular2/docs/bundles/overview.md

Cheers,
Pawel

On Thu, Jan 14, 2016 at 6:06 PM, Justin Bleach <[email protected]> wrote:
> I can import core without any problems doing this:
>
> import {Component} from 'angular2/core';
>
> But for some strange reason when I import http and use it:
>
> import {HTTP_PROVIDERS, Http} from 'angular2/http';
>
> I get this stack trace in the Chrome console:
>
> Error: XHR error (404 Not Found) loading
> http://localhost:8080/pocApp/angular2/http
> Error loading http://localhost:8080/pocApp/angular2/http as "angular2/http"
> from http://localhost:8080/pocApp/app/main-menu.service.js
>     at error
> (http://localhost:8080/pocApp/node_modules/systemjs/dist/system.src.js:1020:16)
>     at XMLHttpRequest.xhr.onreadystatechange [as _onreadystatechange]
> (http://localhost:8080/pocApp/node_modules/systemjs/dist/system.src.js:1028:13)
>     at Zone.run
> (http://localhost:8080/pocApp/node_modules/angular2/bundles/angular2-polyfills.js:138:17)
>     at XMLHttpRequest.zoneBoundFn
> (http://localhost:8080/pocApp/node_modules/angular2/bundles/angular2-polyfills.js:111:19)
>
> I'm not new to Angular but of course I am new to Angular2. I've followed the
> 5 min quickstart followed by the Hero's example. So I can see in my
> node_modules/angular2 directory both the core.js and http.js files.
>
> I feel like I've got something wrong that is simple to fix but I honestly
> can't see what.
>
> Here is the entire JS where http is used if it helps:
>
> import {Injectable} from 'angular2/core';
>
> import {HTTP_PROVIDERS, Http} from 'angular2/http';
>
>
> @Injectable()
>
> export class MainMenuService {
>
>     http:Http;
>
>     constructor(http:Http) {
>
>         this.http = http;
>
>      }
>
>
>
>    getMainMenuItems() {
>
>         return
> this.http.get('http://localhost:8080/pocApp/class/list').map(res =>
> res.json())
>
>     }
>
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.



-- 
AngularJS book:
http://www.packtpub.com/angularjs-web-application-development/book
Looking for bootstrap-based widget library for AngularJS?
http://angular-ui.github.com/bootstrap/

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to