Angular4 - routerLink with typescript

0 votes

I have worked with routerLink and it works very well :

      <a routerLink="inscription" class="btn btn-default">Inscription</a>
      <a routerLink="login" class="btn btn-default">Se connecter</a>

I am trying now to deal with routerLink inside the typescript file. Exactly, when I click on a button, I call a function inside this function I want to call routerLink how could I do it? and if is calling it will reload the page or it will work exactly the same as the routerLink above ?

Jun 16 in TypeSript by Logan
• 1,580 points
8 views

1 answer to this question.

0 votes

In code, you use .navigate instead:

this.router.navigate(['/products']);

You pass it the same parameter as you do the routerLink.

enter image description here

answered 4 days ago by Nina
• 2,900 points

Related Questions In TypeSript

0 votes
1 answer

how to use spread syntax and new Set() with TypeScript

The ... operator should work on anything ...READ MORE

answered Jun 10 in TypeSript by Nina
• 2,900 points
7 views
0 votes
1 answer

How to use useState hook in React with TypeScript correctly?

Without any initial argument, the type of email and setEmail will ...READ MORE

answered Jun 10 in TypeSript by Nina
• 2,900 points
9 views
0 votes
1 answer

How to import library with TypeScript Playground

TypeScript Playground isn't a fully fledged sandbox ...READ MORE

answered Jun 13 in TypeSript by Nina
• 2,900 points
6 views
0 votes
1 answer
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11 in Others by narikkadan
• 10,640 points
495 views
0 votes
0 answers

Can't bind to 'ngModel' since it isn't a known property of 'input'

I have this  input in my component ...READ MORE

Apr 29 in Other DevOps Questions by Kichu
• 19,040 points
101 views
0 votes
1 answer

VS Code enforces semicolons, but why doesn't Angular and TypeScript not use it consistently?

JavaScript has a syntactic feature known as semicolon ...READ MORE

answered May 31 in TypeSript by Nina
• 2,900 points
22 views
0 votes
1 answer

Square brackets around vs after expression in Typescript

x is an Array, while y is a Tuple. The ...READ MORE

answered Jun 7 in TypeSript by Nina
• 2,900 points
17 views
0 votes
1 answer

Interface type check with Typescript

You can achieve what you want without ...READ MORE

answered May 31 in TypeSript by Nina
• 2,900 points
34 views
0 votes
1 answer

Customise Ngx-toastr in angular 6 with TypeScript

After Override this CSS in your Style.css File. I ...READ MORE

answered Jun 9 in TypeSript by Nina
• 2,900 points
6 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP