Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  175] [ 6]  / answers: 1 / hits: 25983  / 7 Years ago, wed, march 15, 2017, 12:00:00

I wonder if there is a way to execute something after i navigate to a different view using angular router.



this.router.navigate([/search, 1, ]);
// Everything after navigate does not not get executed.
this.sideFiltersService.discoverFilter(category);

More From » angular

 Answers
28

this.router.navigate returns a promise so you can simply use:





this.router.navigate([/search, 1, ]).then(()=>{
// do whatever you need after navigation succeeds
});




[#58540] Monday, March 13, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mariann

Total Points: 201
Total Questions: 133
Total Answers: 107

Location: Czech Republic
Member since Thu, Aug 11, 2022
2 Years ago
;