Questions tagged [angular-routerlink]

220 questions
2
votes
0 answers

Angular - ActivatedRoute in click event

I am using ActivatedRoute to call the summary table from one component to another component and I added below I am not able to get the summary table as expected in click event tab-routing.module.ts import { NgModule } from '@angular/core'; import {…
2
votes
1 answer

routerLinkActive class dosen't apply if there is already a class present to that component

I came across a wired problem where I have an angular material sidebar and in that I have buttons used for routing the applications let me put the code below
2
votes
1 answer

Why RouterLink adds the input to the end of current URL in bracket

Lets say my url is: http://localhost:4200/user_id/home. Here is my button code: Payments Because I was…
SigGP
  • 716
  • 1
  • 11
  • 24
2
votes
2 answers

Why does a disabled RouterLink still work?

Problem I have a problem with links, which are active, although their disabled attribute is set to true. Setup Following this pattern from the official documentation of Angular Material:
scopchanov
  • 7,966
  • 10
  • 40
  • 68
2
votes
1 answer

routerLinkActive with dynamic url doesn't work Angular 9

I have the following html template: some text When I click on that link I see item is selected but when I reload page (press F5) then I see no selected…
A. Gladkiy
  • 3,134
  • 5
  • 38
  • 82
2
votes
1 answer

Angular 9 - Single SPA sub routing issue

I have been looking around trying to find an answer to this problem but I can't, apologies if this has already been asked! I have created some small angular 9 apps which I am importing into a basic html page using single spa. I have my apps…
2
votes
0 answers

How to make RouterLinkActive got an access to RouterLink which is provided within ng-template

Is there any way to provide an access to ContentChildren which are inside ng-template? If you look at the example you see the issue - the routerLinkActive directive does not see any routerLink directives in the second row.
constantant
  • 1,192
  • 1
  • 13
  • 25
2
votes
1 answer

Named router outlet doesn't render template in lazy loaded route

I have a problem with my angular 8 app, not rendering into a named router-outlet. The routes are: routes.module: const routes: Routes = [ ... { path: 'settings', loadChildren: './settings/settings.module#SettingsModule',…
2
votes
2 answers

When should href be used instead of routerLink in Angular?

When I develop in Angular and create views, I always use the routerLink to navigate from one view to another. Recently I have seen important pages made in Angular that use href instead of routerLink to route views on the website. My question is,…
2
votes
2 answers

Angular "Error: Cannot match any routes. URL Segment" when using [routerLink], but it works with this.router.navigate

I have a primary and a named outlet in my application defined as follows: I have defined a route to be used with this center component in my app-routing: const routes:…
plex4r
  • 243
  • 1
  • 2
  • 15
2
votes
3 answers

Is it okay to add Angular routerLink to HTML tags to avoid SEO issues?

If I add routerLink to an HTML tag, the routerLink works perfect, meaning it takes preference over the natural new http request. Example: Go to page view Why would I do that? To let crawlers correctly…
Álvaro Franz
  • 699
  • 9
  • 26
2
votes
5 answers

Angular get matched url path in Guard

my routing is { path:'contacts/:id', component: contactDetail } in canActivateChild( route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { console.log(state.url); } state.url return /contacts/1 what I need is matched url /contact/:id…
2
votes
1 answer

RouterLink in storybook?

I'm trying to add my component to Storybook and its throwing an error related to RouterLink and it not been part of Ionic components. Error: Template parse errors: Can't bind to 'routerLink' since it isn't a known property of 'ion-card'. 1. If…
2
votes
2 answers

Conditionally apply either href or routerLink without *ngIf

I have the following code in my Angular app template, which does not work as expected:
1 2
3
14 15