0

How can we provide our own page title strategy in a standalone main.ts, similar to how we provide a page title strategy using modules?

@NgModule({
  ...
  providers: [
    ...,
    { provide: MyTitleStrategy, useClass: PageTitleStrategy }
  ],
})
export class AppRoutingModule { }
flyingpluto7
  • 1,079
  • 18
  • 20

1 Answers1

0

To use PageTitleStrategy in a standalone application you can provide it on bootstrap applications providers array

main.ts

const appConfig: ApplicationConfig = {
        providers: [
            provideRouter(routes),
            { provide: MyTitleStrategy, useClass: PageTitleStrategy },
        ],
 };

bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
Chellappan வ
  • 23,645
  • 3
  • 29
  • 60