mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-12 17:43: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 = [
|
||||
{path: '', component: LandingpageComponent},
|
||||
{path: 'product', component: ProductDetailPageComponent}
|
||||
{path: 'product/:id', component: ProductDetailPageComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
|
|
@ -1 +1 @@
|
|||
<p>product-detail-page works!</p>
|
||||
<p>product-detail-page works! Product: {{productId}}</p>
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-product-detail-page',
|
||||
templateUrl: './product-detail-page.component.html',
|
||||
styleUrls: ['./product-detail-page.component.css']
|
||||
selector: 'app-product-detail-page',
|
||||
templateUrl: './product-detail-page.component.html',
|
||||
styleUrls: ['./product-detail-page.component.css']
|
||||
})
|
||||
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