AnchovyLegend AnchovyLegend - 10 months ago 85
TypeScript Question

Dependency injection causing build to break

I am working on a project in which I need to use Http on the service layer. Below I am trying to inject Http in to the constructor as I normally would, however when trying to do

ionic build ios
I am getting the following errors:

[08:54:51] Error: Error at /Users/zzz/Sites/angular-app/Test-Wondersign/.tmp/pages/home/home.ngfactory.ts:64:29
[08:54:51] Supplied parameters do not match any signature of call target.
[08:54:51] ngc failed
[08:54:51] ionic-app-script task: "build"
[08:54:51] Error: Error


import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { HomeService } from '../home/home.service';

selector: 'page-home',
templateUrl: 'home.html',
providers: [HomeService]
export class HomePage {

users: any;

constructor(public navCtrl: NavController, public hs: HomeService) {


loadUsers() {
this.hs.getUsers().then( (response) => {
this.users = JSON.parse(response._body);


import { Http,Headers, RequestOptions } from '@angular/http';
import {Inject} from '@angular/core';

export class HomeService {
constructor(@Inject(Http) public http: Http) {
this.url ='';

getUsers(): Promise<any> {
return new Promise((resolve, reject) => {

this.http.get(this.url).subscribe( result => {



<ion-content padding>
<div *ngFor="let user of users">
{{}} {{}}

Answer Source

Your HomeService must be annotated with @Injectable.