Skip to content

Commit 66e4cf7

Browse files
committed
Add altternate syntax to read the URL from the route.
1 parent 99ccf5b commit 66e4cf7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

APM-Final/src/app/products/product-detail.guard.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export class ProductDetailGuard implements CanActivate {
1313
next: ActivatedRouteSnapshot,
1414
state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
1515
const id = +next.url[1].path;
16+
// const id2 = next.paramMap.get('id');
17+
// console.log(id2);
1618
if (isNaN(id) || id < 1) {
1719
alert('Invalid product Id');
1820
this.router.navigate(['/products']);

0 commit comments

Comments
 (0)