src/app/app.module.ts
Главный модуль
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LOCALE_ID, NgModule } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { FormsModule } from '@angular/forms';
import { Http, HttpModule, RequestOptions } from '@angular/http';
import { TopMenuBxModule } from 'glx.ui/components/topMenuBx/topMenuBx';
import { PageTitleBxModule } from 'glx.ui/components/pageTitleBx/pageTitleBx';
import { AppRoutingModule } from './app.routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home';
import { CommonService } from 'glx.ui/components/kernel/services/common.service';
import { SettingsService } from 'glx.ui/components/kernel/services/settings.service';
import { ProfileService } from 'glx.ui/components/kernel/services/profile.service';
import { AuthConfig, AuthHttp } from 'angular2-jwt';
/**
* Фабрика для авторизации через JWT (Без Битрикс)
* @param {Http} http
* @param {RequestOptions} options
* @returns {AuthHttp}
*/
export function authHttpServiceFactory(http: Http, options: RequestOptions) {
return new AuthHttp(new AuthConfig({}), http, options);
}
/**
* Главный модуль
*/
@NgModule({
declarations: [
AppComponent,
HomeComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
HttpModule,
AppRoutingModule,
NgbModule.forRoot(),
TopMenuBxModule,
PageTitleBxModule
],
providers: [
{
provide: LOCALE_ID,
useValue: 'ru-RU'
},
{
provide: AuthHttp,
useFactory: authHttpServiceFactory,
deps: [Http, RequestOptions]
},
CommonService,
SettingsService,
ProfileService
],
bootstrap: [AppComponent]
})
export class AppModule {
}