I m written Angular app with @ngx-translate Depend so I configuised Pack under doc:
import { BrowserAnimationsModule } from @angular/platform-browser/animations ;
import { BrowserModule } from @angular/platform-browser ;
import { HttpClient, HttpClientModule } from @angular/common/http ;
import { NgModule } from @angular/core ;
import { TranslateHttpLoader } from @ngx-translate/http-loader ;
import { TranslateModule, TranslateLoader } from @ngx-translate/core ;
import { AppComponent } from ./main ;
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, assets/i18n/ , .json );
}
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
TranslateModule.forRoot({
defaultLanguage: en ,
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
}),
],
bootstrap: [AppComponent],
})
export class AppModule {}
接着,我的《防雷法》涵盖了拉波特,我应测试Http LoaderFactory。
I am wondering how can I do this? Code on stackblitz