Get Current Route Name in api.onPageChange Event

Hello Folks,

I want to get the current route name in api.onpagechange event.

	api.onPageChange((url, title) =>{
     
    console.log("Current Route name")
  
  
	});

In this above function, I want current route name. can we get this ?

api.onPageChange((url, title) =>{
  const router = api.container.lookup('service:router');
  console.log(router.currentRoute.name);
}
2 Likes

Thank you so much Richard… You save my day :star_struck:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.