Skip to content

Instantly share code, notes, and snippets.

@KadmaPraveen
Created October 4, 2020 01:59
Show Gist options
  • Save KadmaPraveen/cac15257f38da16d73a74d69433163c5 to your computer and use it in GitHub Desktop.
Save KadmaPraveen/cac15257f38da16d73a74d69433163c5 to your computer and use it in GitHub Desktop.
ngOnInit() {
this.route.paramMap.subscribe(params => {
this.product = products[+params.get('productId')];
});
}
//html
<div *ngFor="let product of products; index as productId">
<h3>
<a [title]="product.name + ' details'" [routerLink]="['/products', productId]">
{{ product.name }}
</a>
</h3>
<!-- . . . -->
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment