Reputation: 17382
I have 3 component from 1st moving to 2nd. But from 2nd I am not able to navigate 3rd component.
Name
showing only hyperlink but when clicking nothing happens.
This is 2nd component code
<table>
<tr *ngFor="let lst of devices; let i = index" border="1">
<td>{{lst.DeviceId}}</td>
<td>{{lst.LastJobStatus}}</td>
<td> <a routerLink="deviceapps">{{lst.Name}}</a> </td>
</tr>
</table>
App-routing.module.ts
class
const routes: Routes = [
{ path: 'devicelist/:id', component: DeviceListComponent } ,
{path: 'deviceapps',component: DeviceAppsComponent}
];
3rd component code
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router, ParamMap } from '@angular/router';
@Component({
selector: 'app-device-apps',
templateUrl: './device-apps.component.html',
styleUrls: ['./device-apps.component.css']
})
export class DeviceAppsComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Upvotes: 1
Views: 1300
Reputation: 38094
It looks like you are using relative paths inside, so try to write absolute routing like:
<a [routerLink]="'/deviceapps'">{{lst.Name}}</a>
Upvotes: 2