How to add routerlink with string interpolation in angular
Component changes:
<a routerLink="/blog/{{blog.id}}">{{blog.title}}</a>
Module changes:
import { RouterModule } from '@angular/router';
imports: [
RouterModule
]
If your component reside inside the feature module, you should also add the import and imports changes into the feature module
You can either use String Interpolation
routerLink="/update/{{obj.id}}"
or Attribute Binding Syntax:
[routerLink]="'/update/' + obj.id"
or as Pankaj suggested, Attribute Binding Syntax like this:
[routerLink]="['/update', obj.id]"