Skip to content

Commit

Permalink
chore: update routing to fix errors of ngx-hover-preload
Browse files Browse the repository at this point in the history
  • Loading branch information
simplejason committed Jul 31, 2022
1 parent 9d50d27 commit feb9f84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion scripts/site/_site/doc/app/app.module.ts
Expand Up @@ -62,7 +62,8 @@ const icons: IconDefinition[] = [LeftOutline, RightOutline, EditOutline];
NzContributorsListModule,
FixedWidgetsModule,
AppRoutingModule,
HoverPreloadModule,
// skip ngx-hover-preload errors
environment.production ? HoverPreloadModule : [],
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production && !environment.preProduction })
],
providers: [
Expand Down
16 changes: 11 additions & 5 deletions scripts/site/_site/doc/app/app.routing.module.ts
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HoverPreloadStrategy } from 'ngx-hover-preload';
import { environment } from '../environments/environment';

import { DEMO_ROUTES } from './router';
import { DEMOComponent } from './_demo/demo.component';
Expand All @@ -19,11 +20,16 @@ export const routes: Routes = [

@NgModule({
imports: [
RouterModule.forRoot(routes, {
preloadingStrategy: HoverPreloadStrategy,
scrollPositionRestoration: 'enabled',
initialNavigation: 'enabledBlocking'
})
RouterModule.forRoot(
routes,
environment.production
? {
preloadingStrategy: HoverPreloadStrategy,
scrollPositionRestoration: 'enabled',
initialNavigation: 'enabledBlocking'
}
: {}
)
],
exports: [RouterModule]
})
Expand Down

0 comments on commit feb9f84

Please sign in to comment.