I'm starting learning Angular2 by following the quickstart they provide in their page, and now I'm trying to make some Http requests. But whenever I bootstrap the component, Chrome keeps giving me this errors:
Uncaught SyntaxError: Unexpected token < http:1
Uncaught SyntaxError: Unexpected token < angular2-polyfills.js:138
Evaluating http://localhost:3000/angular2/http
Error loading http://localhost:3000/app/boot.js
This is the component:
import {Component} from 'angular2/core';
import {HTTP_PROVIDERS, Http} from 'angular2/http';
@Component({
selector: 'users',
providers: [HTTP_PROVIDERS],
templateUrl: 'app/views/users.html'
})
export class UsersComponent {
people: Object[];
constructor(http: Http) {
http.get('http://192.168.56.101/api/test').subscribe(res => {
this.people = res.json();
console.log(this.people);
});
}
}
And the bootstrapping:
import {bootstrap} from 'angular2/platform/browser'
import {UsersComponent} from './components/users'
bootstrap(UsersComponent, [HTTP_PROVIDERS]);
The view is only {{people}}
.
TypeScript is compiling OK. I don't even know what's failing!