I was wondering how you should handle an import of TranslateModule.forChild in a module when adding a single standalone component in an NgModule based angular project

I would like to use TranslateModule.forChild() with isolate:true in Pricing component

I don't have bootstrapApplication method as I see in another support request, so I don't understand if is feasible.

app.module

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        HttpClientModule,
        BrowserAnimationsModule, // required for ng2-tag-input
        CoreModule,
        LayoutModule,
        RoutesModule,
        LaddaModule.forRoot({
            style: "zoom-out",
            //spinnerSize: 10,
            spinnerColor: "white",
            spinnerLines: 12
        }),
  
    ],
    providers: [
        TranslateStore,
    ],
    bootstrap: [AppComponent]

})

routes.ts

{
        path: "pricing",
        loadComponent: () =>
          import("./admin/pricing/pricing/pricing.component").then(
            (m) => m.PricingComponent
          ),

      },

empty pricing component

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '../../../../shared/shared.module';

@Component({
  selector: 'app-pricing',
  standalone: true,
  imports: [SharedModule,],
  
  templateUrl: './pricing.component.html',
  styleUrls: ['./pricing.component.scss']
})
export class PricingComponent {

}

I have tried

{
        path: "pricing",
        loadComponent: () =>
          import("./admin/pricing/pricing/pricing.component").then(
            (m) => m.PricingComponent
          ),
          providers: [importProvidersFrom(TranslateModule.forChild({loader: { provide: TranslateLoader, useFactory: createTranslateLoader, deps: [HttpClient] }, isolate: true }))],
       
      },

......

export function createTranslateLoader(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/pricing/', '.json');
}

But the translate pipe is not found.

Can someone please help? Thanks

0

There are 0 answers