Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

Routing Issue [Ionic 5]

$
0
0

Hi everyone - I’ve been away from Ionic for a year and the routing in Ionic 5 (or better yet, Angular) is messing with me. I want to pass an ID to a page when it’s called however when I do so I get this error:

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'edit-printer/-Ma1zLBxs3EHhnsLtzLw'
Error: Cannot match any routes. URL Segment: 'edit-printer/-Ma1zLBxs3EHhnsLtzLw'

As context, edit-printer is the page and ~Ma1… is the firebase ID I am passing to the edit-printer page. I am linking to the edit-printer page via the HTML of my home page as follows:

<button ion-button clear [routerLink]="['/edit-printer/', printer.$key]">

And finally in edit-printer.page.ts:

export class EditPrinterPage implements OnInit {
  updatePrinterForm: FormGroup;
  id: any;

  constructor(
    private prtService: PrinterService,
    private actRoute: ActivatedRoute,
    private router: Router,
    public fb: FormBuilder
  ) {
    this.id = this.actRoute.snapshot.paramMap.get('id');
    this.prtService.getPrinter(this.id).valueChanges().subscribe(res => {
      this.updatePrinterForm.setValue(res);
    });
  }

I am sure I am doing something stupid but why won’t this work?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>