import { BrowserModule } from '@angular/platform-browser'; import { NgModule, LOCALE_ID } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { ShareModule } from './share-module/share.module'; import { SidebarModule } from './pages/sidebar/sidebar.module'; import { HeaderComponent } from './components/header/header.component'; import { MainComponent } from './components/main/main.component'; import { SidebarComponent } from './components/sidebar/sidebar.component'; import { NavItemComponent } from './components/nav-item/nav-item.component'; import { InputComponent } from './pages/input/input.component'; import { FooterComponent } from './components/footer/footer.component'; import { AnchorComponent } from './components/anchor/anchor.component'; import { NavMenuComponent } from './components/nav-menu/nav-menu.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { HighlightModule } from 'ngx-highlightjs'; import xml from 'highlight.js/lib/languages/xml'; import scss from 'highlight.js/lib/languages/scss'; import typescript from 'highlight.js/lib/languages/typescript'; import { HashLocationStrategy, LocationStrategy } from '@angular/common'; /** * Import every language you wish to highlight here * NOTE: The name of each language must match the file name its imported from */ export function hljsLanguages() { return [ { name: 'typescript', func: typescript }, { name: 'scss', func: scss }, { name: 'xml', func: xml } ]; } @NgModule({ declarations: [ HeaderComponent, AppComponent, MainComponent, SidebarComponent, NavItemComponent, InputComponent, FooterComponent, AnchorComponent, NavMenuComponent, ], imports: [ BrowserModule, BrowserAnimationsModule, AppRoutingModule, ShareModule, SidebarModule, HighlightModule.forRoot({ languages: hljsLanguages }) ], providers: [ { provide: LOCALE_ID, useValue: 'zh-CHS'}, // en | zh-CHS | zh-CHT { provide: LocationStrategy, useClass: HashLocationStrategy } ], bootstrap: [AppComponent] }) export class AppModule {}