1
<app-example [id]="requestId"></app-example>

We have add the selector in another component with passing the id.

export class exampleComponent implements OnInit {
    @Input() id:number;

Id:string;

}
constructor(private fb: FormBuilder, private _AppService: AppService, private router: Router, private route: ActivatedRoute) {
        this.router.getCurrentNavigation().extras.state != undefined ? this.Id = this.router.getCurrentNavigation().extras.state.key : '';
        this.route.data.subscribe(data => {
            this.current_path = data.urlname;
        })
}

we've using the getCurrentNavigation() method, but its return null value

1

1 Answer 1

1

Try something like this

constructor(private router: Router) {

router.events.subscribe((event) => {
  if (event instanceof NavigationEnd) {
    this.current_path = event.url;
 }
})
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.