Error AngularJS 2 undefined index1

I try to reach the MeanStack project, when I try to click the refresh button, I get this error: Error: the requested path contains an undefined segment at index 1

There is an update service

updateLocation(id, data) { return new Promise((resolve, reject) => { this.http.put('https://exemple.herokuapp.com/api/A/'+id, data) .map(res => res.json()) .subscribe(res => { resolve(res); }, (err) => { reject(err); }); }); } 

html

 <form (submit)="onEditSubmit()"> 

And the .ts component

  onEditSubmit() { this.locationService.updateLocation(this.id,this.location).then((result) => { let id = result['_id']; this.router.navigate(['locations/', id]); }, (err) => { console.log(err); }); } 
+2
angular mean-stack
source share
1 answer

replace this.router.navigate(['locations/', id]); at this.router.navigate(['/locations', id]);

+3
source share

All Articles