1.Background
Angular 更新至V16版后,支援 standalone,故移除了 NgModule,而TranslateModule 又要在AppModule中 import,那该如何做呢?文章来源地址https://www.toymoban.com/news/detail-603429.html
2.NPM packages installation
npm install @ngx-translate/core
npm install @ngx-translate/http-loade
3.Import TranslateModule in bootstrapApplication of main.ts
// import ngx-translate and the http loader
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpClient, HttpClientModule } from '@angular/common/http';
// required for AOT compilation
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http);
}
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(
NzMessageServiceModule,
NzDrawerServiceModule,
NzModalModule
文章来源:https://www.toymoban.com/news/detail-603429.html
到了这里,关于[Angular] Import TranslateModule in Angular 16的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!