accountant-ui/src/app.module.ts
2017-07-21 00:29:03 +02:00

54 lines
1.6 KiB
TypeScript

// vim: set tw=80 ts=2 sw=2 sts=2:
import 'zone.js';
import 'reflect-metadata';
import './app.ts';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { UpgradeModule } from '@angular/upgrade/static';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { NgLoggerModule } from '@nsalaun/ng-logger';
import { RestangularModule } from 'ngx-restangular';
import { ToastrModule } from 'ngx-toastr';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { AccountModule } from './accounts/account.module';
import { ApiBaseURL, LogLevel } from './app.config';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
UpgradeModule,
AccountModule,
NgLoggerModule.forRoot(LogLevel),
RestangularModule.forRoot((RestangularProvider) => {
RestangularProvider.setBaseUrl(ApiBaseURL);
// Inject JSON in error instead the full response object.
RestangularProvider.setErrorInterceptor(
function(response, subject, responseHandler) {
// TODO Alexis Lahouze 2017-07-16 Handle 401 error.
subject.error(response.json());
return false;
}
);
}),
ToastrModule.forRoot(),
NgbModule.forRoot()
]
})
export class AppModule {
constructor(private upgrade: UpgradeModule) { }
ngDoBootstrap() {
this.upgrade.bootstrap(document.body, ['accountant'], { strictDi: false });
}
}
platformBrowserDynamic().bootstrapModule(AppModule);