app.module.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { BrowserModule } from '@angular/platform-browser';
  2. import { NgModule } from '@angular/core';
  3. import { CommonModule } from '@angular/common';
  4. import { AppRoutingModule } from './app-routing.module';
  5. import { AppComponent } from './app.component';
  6. import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
  7. import { registerLocaleData, HashLocationStrategy, LocationStrategy } from '@angular/common';
  8. import zh from '@angular/common/locales/zh';
  9. import { HttpInterceptorService } from './services/httpInterceptor.service';//请求拦截器
  10. import { ShareModule } from './share/share.module';
  11. import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
  12. import { NZ_I18N, zh_CN, NzConfig, NZ_CONFIG } from 'ng-zorro-antd';
  13. const ngZorroConfig: NzConfig = {
  14. // 注意组件名称没有 nz 前缀
  15. notification: { nzTop: 100 }
  16. };
  17. registerLocaleData(zh);
  18. @NgModule({
  19. declarations: [
  20. AppComponent,
  21. ],
  22. imports: [
  23. BrowserModule,
  24. CommonModule,
  25. BrowserAnimationsModule,
  26. AppRoutingModule,
  27. HttpClientModule,
  28. ShareModule,
  29. ],
  30. providers: [
  31. { provide: NZ_I18N, useValue: zh_CN },
  32. { provide: NZ_CONFIG, useValue: ngZorroConfig },
  33. { provide: LocationStrategy, useClass: HashLocationStrategy },
  34. { provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true },
  35. ],
  36. bootstrap: [AppComponent]
  37. })
  38. export class AppModule { }