mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-22 14:23:57 +00:00
BETTERZON-41: Added routing for product detail pages
This commit is contained in:
parent
38b20d28cb
commit
87193310a8
|
@ -8,7 +8,7 @@ import {ProductDetailPageComponent} from './product-detail-page/product-detail-p
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{path: '', component: LandingpageComponent},
|
{path: '', component: LandingpageComponent},
|
||||||
{path: 'product', component: ProductDetailPageComponent}
|
{path: 'product/:id', component: ProductDetailPageComponent}
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<p>product-detail-page works!</p>
|
<p>product-detail-page works! Product: {{productId}}</p>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {Router} from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-product-detail-page',
|
selector: 'app-product-detail-page',
|
||||||
|
@ -6,8 +7,13 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./product-detail-page.component.css']
|
styleUrls: ['./product-detail-page.component.css']
|
||||||
})
|
})
|
||||||
export class ProductDetailPageComponent implements OnInit {
|
export class ProductDetailPageComponent implements OnInit {
|
||||||
|
productId: string;
|
||||||
|
|
||||||
constructor() { }
|
constructor(
|
||||||
|
private router: Router
|
||||||
|
) {
|
||||||
|
this.productId = router.url.substr(9, router.url.length);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user