Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace deprecated withServerTransition in Angular 16?

In Angular 16, withServerTransition is deprecated. How can I replace it?

enter image description here.

I tried the following code:

imports: [
  BrowserModule,
  { provide: APP_ID, useValue: 'serverApp' },
  ...
],

But I'm getting the following error:

Type '{ provide: InjectionToken<string>; useValue: string; }' is not assignable to type 'any[] | Type<any> | ModuleWithProviders<{}>'.
  Object literal may only specify known properties, and 'provide' does not exist in type 'any[] | Type<any> | ModuleWithProviders<{}>'.ts(2322)
(property) provide: InjectionToken<string>
like image 246
Sree Velmurugan Avatar asked Jul 22 '26 22:07

Sree Velmurugan


1 Answers

You almost got it right, this should go in the providers object instead of the import

providers : [{ provide: APP_ID, useValue: 'serverApp' }],
like image 178
Matthieu Riegler Avatar answered Jul 28 '26 09:07

Matthieu Riegler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!