| | |
| | | import { BrowserModule } from '@angular/platform-browser'; |
| | | import { NgModule, LOCALE_ID, APP_INITIALIZER, Injector } from '@angular/core'; |
| | | import { HttpClient, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; |
| | | import { BrowserModule } from '@angular/platform-browser'; |
| | | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
| | | import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core'; |
| | | import { TranslateHttpLoader } from '@ngx-translate/http-loader'; |
| | | import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http'; |
| | | |
| | | import { CoreModule } from './core/core.module'; |
| | | import { SharedModule } from './shared/shared.module'; |
| | | import { DelonModule } from './delon.module'; |
| | | import { CoreModule } from '@core/core.module'; |
| | | import { SharedModule } from '@shared/shared.module'; |
| | | import { AppComponent } from './app.component'; |
| | | import { RoutesModule } from './routes/routes.module'; |
| | | import { LayoutModule } from './layout/layout.module'; |
| | | import { StartupService } from './core/services/startup.service'; |
| | | import { StartupService } from '@core/startup/startup.service'; |
| | | import { DefaultInterceptor } from '@core/net/default.interceptor'; |
| | | import { AlainAuthModule, SimpleInterceptor } from '@delon/auth'; |
| | | |
| | | // i18n |
| | | import { I18NService } from './core/i18n/i18n.service'; |
| | | import { ALAIN_I18N_TOKEN } from '@delon/theme'; |
| | | |
| | | import { SimpleInterceptor } from '@delon/auth'; |
| | | // angular i18n |
| | | import { registerLocaleData } from '@angular/common'; |
| | | import localeZhHans from '@angular/common/locales/zh-Hans'; |
| | | registerLocaleData(localeZhHans); |
| | | // i18n |
| | | import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; |
| | | import { TranslateHttpLoader } from '@ngx-translate/http-loader'; |
| | | import { ALAIN_I18N_TOKEN } from '@delon/theme'; |
| | | import { I18NService } from '@core/i18n/i18n.service'; |
| | | import { LoginService } from '@business/services/http/login.service'; |
| | | |
| | | // AoT requires an exported function for factories |
| | | export function HttpLoaderFactory(http: HttpClient) { |
| | |
| | | imports: [ |
| | | BrowserModule, |
| | | BrowserAnimationsModule, |
| | | SharedModule.forRoot(), |
| | | HttpClientModule, |
| | | DelonModule, |
| | | CoreModule, |
| | | SharedModule, |
| | | LayoutModule, |
| | | RoutesModule, |
| | | // auth |
| | | AlainAuthModule.forRoot({ |
| | | login_url: `/pro/user/login` |
| | | }), |
| | | // i18n |
| | | TranslateModule.forRoot({ |
| | | loader: { |
| | |
| | | }) |
| | | ], |
| | | providers: [ |
| | | { provide: LOCALE_ID, useValue: 'zh-Hans' }, |
| | | { provide: HTTP_INTERCEPTORS, useClass: SimpleInterceptor, multi: true}, |
| | | { provide: HTTP_INTERCEPTORS, useClass: DefaultInterceptor, multi: true}, |
| | | // loginservice 里储存了token,放在全局 |
| | | LoginService, |
| | | { provide: LOCALE_ID, useValue: 'zh-Hans' }, |
| | | { provide: HTTP_INTERCEPTORS, useClass: SimpleInterceptor, multi: true}, |
| | | { provide: HTTP_INTERCEPTORS, useClass: DefaultInterceptor, multi: true}, |
| | | { provide: ALAIN_I18N_TOKEN, useClass: I18NService, multi: false }, |
| | | StartupService, |
| | | { |