Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core & keepalive): [On behalf of Planally Sdn Bhd]: Angular 17 migration #200

Merged
merged 5 commits into from
Jun 21, 2024

Conversation

msibhuiyan
Copy link
Contributor

@msibhuiyan msibhuiyan commented Jun 10, 2024

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[X] Other : Update deps version

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

Does this PR introduce a breaking change? (check one with "x")

[X] Yes
[ ] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:
Although this PR helped us to use with standalone component, but the old NgModule approach is still available to use.

Migrated to angular 17 and upgraded peerdependencies of core and
keepalive to angular 17

BREAKING CHANGE: 🧨 New angular version upgradation
Exposed providers array from module files
Used standalone component in docs example

BREAKING CHANGE: 🧨 Remvoed regular component and App Module, Introduced AppConfig to
configure necessary services
Fixed test running issue for docs
Angular 17 starts with minimum of node 18
@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling ec8d0ce on planally:angular-17-migration
into 08ce89e on moribvndvs:master.

@grbsk
Copy link
Owner

grbsk commented Jun 21, 2024

Thanks @BhuiyanSaif18 for this PR.

@grbsk grbsk merged commit 4b7ea35 into grbsk:master Jun 21, 2024
10 checks passed
@msibhuiyan msibhuiyan changed the title Angular 17 migration feat(core & keepalive): [On behalf of Planally Sdn Bhd]: Angular 17 migration Jul 3, 2024
@HarelM
Copy link
Contributor

HarelM commented Aug 21, 2024

Any chance for a migration guide from how it used to work with Module vs how to use it now?
I've having a hard time understanding this change...

@msibhuiyan
Copy link
Contributor Author

Any chance for a migration guide from how it used to work with Module vs how to use it now? I've having a hard time understanding this change...

Hi @HarelM, This PR added support for new service registration approach in ApplicationConfig.
Previously we used to configure our NgModule like this

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    NgIdleKeepaliveModule.forRoot() // use NgIdleModule.forRoot() if not using keepalive
   // We registered the NgIdle modules here.
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Now in the new ApplicationConfig approach we register the NgIdle services like this & remove the NgIdleKeepaliveModule.forRoot() from NgModules.

export const appConfig: ApplicationConfig = {
  providers: [
    provideZoneChangeDetection({ eventCoalescing: true }),
    provideRouter(routes),
    provideNgIdleKeepalive(), // use provideNgIdle() if not using keepalive
   // We are registering NgIdle services here
    provideHttpClient(withFetch())
  ]
};

Now this ApplicationConfig allows us to register the service at root level, we can move service registration to component level with provideNgIdleKeepalive(), provideNgIdle() by using the providers array of component or route.

Please do let me know if you need more clarifications.

@HarelM
Copy link
Contributor

HarelM commented Aug 26, 2024

Thanks for the info! This was very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants