import { NgModule } from '@angular/core' ; import { BrowserAnimationsModule } from '@angular/platform-browser/animations' ; import { AuthHttp , AuthConfig } from 'angular2-jwt' ; import { Http , RequestOptions } from '@angular/http' ; import { NonAuthGuard , AuthGuard , HelpersService , UserService , MoviesService } from './services' ; import { SharedModule } from './../shared/shared.module' ; export function authHttpServiceFactory ( http , options ) { return new AuthHttp ( new AuthConfig ( { tokenName : 'token' , noTokenScheme : true , globalHeaders : [ { 'X-CSRFToken' : localStorage . getItem ( 'csrftoken' ) , } ] , } ) , http , options ) ; } @ NgModule ( { imports : [ SharedModule , BrowserAnimationsModule , ] , providers : [ HelpersService , MoviesService , UserService , AuthGuard , NonAuthGuard , { provide : AuthHttp , useFactory : authHttpServiceFactory , deps : [ Http , RequestOptions ] } ] } ) export class CoreModule { }