I am trying to port a small Angular 1 app to Angular 2 and so far I've had issues with Http that I couldn't resolve. As soon as I inject HTTP_PROVIDERS, I get the following error:
Uncaught SyntaxError: Unexpected token < Evaluating
http://localhost:3000/angular2/http Error loading
http://localhost:3000/app/main.js
Here's the code for my main.ts:
import {bootstrap} from 'angular2/platform/browser';
import {AppConverter} from './app.converter';
import {CurrencyService} from './services/service.currencies';
import {RippleService} from './services/service.ripple';
import {HTTP_PROVIDERS, Http} from 'angular2/http';
bootstrap(AppConverter, [CurrencyService, HTTP_PROVIDERS, RippleService]);
And here's the service where I tried to use it, although it's commented for now:
import {Http} from 'angular2/http';
import {Inject, Injectable} from 'angular2/core';
@Injectable()
export class RippleService {
requestUrl: string= null;
constructor(url: string) // public httpService:Http, url: string){
this.requestUrl = url;
}
}
If I remove HTTP_PROVIDERS
from main.ts
, the error disappears and my app displays fine.But ofcourse there is no http service
. Either it's a bug in Angular, or I'm not doing this right (I assume it's #2).
I am using Angular 2.0.0 beta 6