Currently in the process of upgrading my Ionic2.beta11 App to the latest release, Ionic2.rc0. Most aspects have been relatively smooth sailing, but I've hit a roadblock with the AoT compiler.
Specifically, I'm encountering an issue with my AuthService:
@Injectable()
export class AuthService {
constructor(@Inject(Http) http: Http) {
this.http = http;
}
...
}
Within my app, I'm injecting the AuthService into the src/app/app.module.ts
file:
@NgModule({
declarations: [
MyApp,
...
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
...
],
providers: [
AuthService
]
})
While everything functions correctly during ionic serve, complications arise when attempting to build, resulting in the following error message:
ngc error: Error: Error at .../.tmp/app/app.module.ngfactory.ts:397:78: Supplied parameters do not match any signature of call target.
Lines 396 - 399:
get _AuthService_74():import44.AuthService {
if ((this.__AuthService_74 == (null as any))) { (this.__AuthService_74 = new import44.AuthService()); }
return this.__AuthService_74;
}
The crux of the issue lies in new import44.AuthService()
expecting a parameter of type http.
Interestingly, making a manual adjustment in the definition file from constructor(http: Http)
to constructor()
resolves the problem.
Despite scouring through various StackOverflow responses, none of the proposed solutions have remedied my situation.
Should I modify the constructor in the AuthService or alter how it's injected into my app? Any assistance would be greatly appreciated.