I need to dynamically add an ID using JavaScript
@Component({
selector: 'kit-general-16',
templateUrl: './16.component.html',
styleUrls: ['./16.component.scss'],
})
export class CuiGeneral16Component implements OnChanges {
@Input() id: string
@Input() name: string
@Input() price: string
@Input() oldPrice: string
setFavorite() {
this.isFavorite = !this.isFavorite
}
ngOnChanges() {}
}
Component:
<kit-general-16 [name]="product.name" [price]="product.price" [oldPrice]="product.oldPrice" routerLink="../edit-product/{product.id}"></kit-general-16>
How can I replace the value {product.id}
inside routerLink
?
Currently, it displays as
edit-product/%257Bproduct.id%257D