[Solved] Property 'id' comes from an index signature, so it must be accessed with ['id'].

 


Angular ActiviatedRoute Property 'id' comes from an index signature, so it must be accessed with ['id'].

Solution

Use index instead of (.) operator.

ngOnInit(): void {
    this.activatedRouter.params.subscribe((x) => {
      alert(x['id']);
    });
  }
Reactions

Post a Comment

0 Comments