Angular router doesn't go to Component directly?

拟墨画扇 提交于 2020-01-30 11:55:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!