If I pass parameters to the constructor the app stops working. This seems to be related solely to ASP.NET 5.
app.component.ts
import { Component } from 'angular2/core'; import { DataService } from './data.service'; @Component({ selector: 'app', providers: [DataService], template: `<h1>Hello World</h1><li *ngFor="#customer of customers"><span>{{customer.firstName}}</span> </li> ` }) export class AppComponent { public customers: any[]; constructor(private dataService: DataService) { this.dataService = dataService; } ngOnInit() { this.dataService.getCustomers() .subscribe((customers: any[]) => { this.customers = customers; }); } }
data.service.ts
import { Injectable } from 'angular2/core'; import { Http, Response } from 'angular2/http'; import 'rxjs/add/operator/map'; @Injectable() export class DataService { constructor(private http: Http) { this.http = http; } getCustomers() { return this.http.get('customers.json') .map((res: Response) => res.json()); } }