I'm currently receiving the following error:
EXCEPTION: No provider for Http! (Login -> AuthHttp -> Http)
AuthHttp is a reference to Angular2-jwt. Could this be an issue with that? I've been staring at this for a while, and I can't find what error I could possibly have.
In my login.ts:
import {Component} from 'angular2/core';
import {
FORM_DIRECTIVES,
FormBuilder,
ControlGroup,
Validators,
AbstractControl,
Control
} from 'angular2/common';
import {Http, Headers} from 'angular2/http';
import {Router} from 'angular2/router';
import {ButtonRadio} from 'ng2-bootstrap/ng2-bootstrap';
import {AuthHttp, AuthConfig} from 'angular2-jwt';
import {AuthService} from '../../services/auth/authService';
import {AlertService} from '../../services/alerts/alertsService';
import {User} from '../../datatypes/user/user';
@Component({
selector: 'login',
template: require('./login.html'),
directives: [ ButtonRadio, FORM_DIRECTIVES ],
providers: [AuthService, AlertService, Http, AuthHttp]
})
In my main.ts:
document.addEventListener('DOMContentLoaded', function main() {
bootstrap(App, [
('production' === process.env.ENV ? [] : ELEMENT_PROBE_PROVIDERS),
HTTP_PROVIDERS,
ROUTER_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy }),
provide(AuthConfig, { useFactory: () => {
return new AuthConfig({
headerName: 'Authorization',
//headerPrefix: 'Bearer ',
tokenName: 'auth_token',
noJwtError: true
});
}}),
AuthHttp,
Http,
ConnectionBackend
])
.catch(err => console.error(err));
});