0

I am not able to bind variable in to a url as a parameter using href in angular

https://example.com/a.action?type='+{{b}}">

when ever I put the variable under interpolation or bind [href] it is not clickable and also not working

1 Answer 1

3

For your view:

<a [routerLink]="['../user' + user.id]">{{user.name}}</a>

or with params

<a [routerLink]="['/profile/3']" [queryParams]="{position:'boss', 'salary': 'expensive' }">

Controller URL manipulation

this.router.navigate(['profile/3'], { queryParams: { position: pos, 'salary': 'expensive' } }); // add .then(() => {}) for promise

To get the route info: private route: ActivatedRoute

To update the route: private router: Router

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.