问题
I have created a data table (see Image 1) with one column that has a button inside of it. This button changes the application's route and navigates to a detail component(see code below & URL).
goToDetailOfWearable(wearable: ResultWearable) {
console.log(wearable);
this.resultService.sendResultWearableToService(wearable).then(
() => {
this.languageService.languageSelectAvailable.next(true);
this.router.navigateByUrl('Home/ProcessCategory/Processes/Activities/Result/Details').then(
(x) => console.log(x)
);
}
);
}
However this button doens't route, just clears the data table (see Image 2). But if I navigate back and directly forward with the browser (so go back to the data table, and forward to the detail component with the browser). It now correctly routes to the correct route (see Image 3).
Datatable Component, with button in red
Result of button click
Correct route, accessed by navigating back and forth with the browser(red square)
Updated the button method
来源:https://stackoverflow.com/questions/48186768/angular-router-doesnt-go-to-component-directly