UNPKG

ng-jhipster

Version:

A Jhipster util library for Angular 2

64 lines (63 loc) 2.53 kB
import { NgModule } from '@angular/core'; import { HttpModule, Http } from '@angular/http'; import { CommonModule } from '@angular/common'; import { TranslateModule, MissingTranslationHandler, TranslateLoader } from 'ng2-translate/ng2-translate'; import { JHI_PIPES, JHI_DIRECTIVES, JHI_COMPONENTS, JHI_SERVICES } from './src/jhi-components'; import { JhiMissingTranslationHandler, TranslatePartialLoader, JhiTranslateComponent, JhiLanguageService } from './src/language'; import { ConfigHelper } from './src/helper'; // Re export the files export * from './src/pipe'; export * from './src/directive'; export * from './src/service'; export * from './src/component'; export * from './src/language'; export * from './src/interceptor'; export function translatePartialLoader(http) { return new TranslatePartialLoader(http, 'i18n', '.json'); } export function missingTranslationHandler() { return new JhiMissingTranslationHandler(); } export var NgJhipsterModule = (function () { function NgJhipsterModule() { } NgJhipsterModule.forRoot = function (providedConfig) { ConfigHelper.setModuleConfigOptions(providedConfig); return { ngModule: NgJhipsterModule, providers: JHI_SERVICES.concat([ JhiLanguageService ]) }; }; NgJhipsterModule.decorators = [ { type: NgModule, args: [{ imports: [ TranslateModule.forRoot({ provide: TranslateLoader, useFactory: translatePartialLoader, deps: [Http] }), HttpModule, CommonModule ], declarations: JHI_PIPES.concat(JHI_DIRECTIVES, JHI_COMPONENTS, [ JhiTranslateComponent ]), providers: [ { provide: MissingTranslationHandler, useFactory: missingTranslationHandler } ], exports: JHI_PIPES.concat(JHI_DIRECTIVES, JHI_COMPONENTS, [ JhiTranslateComponent, TranslateModule, HttpModule, CommonModule ]) },] }, ]; /** @nocollapse */ NgJhipsterModule.ctorParameters = function () { return []; }; return NgJhipsterModule; }());