angular2-jwt: No provider for AuthConfig

Viewed 1605

Im tying to use the angular2-jwt with my ionic2 application and I keep getting No provider for AuthConfig!

Here is my app.ts:

import {AuthHttp, AuthConfig} from 'angular2-jwt';
import {Http} from 'angular2/http'
@App({
  template: '<ion-nav [root]="rootPage"></ion-nav>',
  config: {}, // http://ionicframework.com/docs/v2/api/config/Config/
  providers: [
     provide(AuthHttp, {
      useFactory: (http) => {
        return new AuthHttp(new AuthConfig(), http);
      },
      deps: [Http]
     }),
    AuthHttp
  ]
})

And im using that on my login.ts page:

import {AuthHttp, AuthConfig} from 'angular2-jwt';
@Page({
  templateUrl: 'build/pages/login/login.html',
  directives: [IONIC_DIRECTIVES]
})
export class LoginPage {
     constructor(private authHttp: AuthHttp){
     }

}
2 Answers
Related