Here is the full console output. I just noticed.... I wonder if the 404 is 
coming from the endpoint in the http.get I am doing.... which explains the 
XHR 404. I think I may have answered my own question.

Navigated to http://localhost:8080/pocApp/
GET http://localhost:8080/pocApp/angular2/http 404 (Not Found)
XHR finished loading: GET "http://localhost:8080/pocApp/angular2/http";.
Error: XHR error (404 Not Found) loading 
http://localhost:8080/pocApp/angular2/http

On Thursday, January 14, 2016 at 12:06:50 PM UTC-5, Justin Bleach 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.

Reply via email to