Skip to content

Commit caa266e

Browse files
committed
Remove product module when standalone
1 parent bbbb0b9 commit caa266e

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

APM-Final-v16/src/app/app.config.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
1+
import { ApplicationConfig } from '@angular/core';
22
import { provideRouter } from '@angular/router';
33

44
import { routes } from './app.routes';
5-
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
6-
import { BrowserModule } from '@angular/platform-browser';
7-
import { ProductModule } from './products/product.module';
5+
import { provideHttpClient } from '@angular/common/http';
86

97
export const appConfig: ApplicationConfig = {
108
providers: [
11-
importProvidersFrom(BrowserModule, ProductModule),
12-
provideHttpClient(withInterceptorsFromDi()),
13-
provideRouter(routes)
9+
provideHttpClient(),
10+
provideRouter(routes)
1411
]
1512
};

APM-Final-v16/src/app/app.routes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ import { WelcomeComponent } from './home/welcome.component';
44
export const routes: Routes = [
55
{ path: 'welcome', component: WelcomeComponent },
66
{ path: '', redirectTo: 'welcome', pathMatch: 'full' },
7-
{ path: '**', redirectTo: 'welcome', pathMatch: 'full' }
7+
{
8+
path: 'products',
9+
loadChildren: () => import('./products/product.routes').then(r => r.PRODUCT_ROUTES)
10+
},
11+
{ path: '**', redirectTo: 'welcome', pathMatch: 'full' },
812
];

APM-Final-v16/src/app/products/product.module.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Routes } from "@angular/router";
2+
import { ProductDetailComponent } from "./product-detail.component";
3+
import { ProductDetailGuard } from "./product-detail.guard";
4+
import { ProductListComponent } from "./product-list.component";
5+
6+
export const PRODUCT_ROUTES: Routes = [
7+
{ path: '', component: ProductListComponent },
8+
{
9+
path: ':id',
10+
canActivate: [ProductDetailGuard],
11+
component: ProductDetailComponent
12+
}];

0 commit comments

Comments
 (0)