NativeScript Angular back to previous route instead of pushing it as new page


I use one of the ns-angular demo apps. Back functionality works fine with hardware back button. It means it remove current page and back to previous page. But with code, NativeScript team has such implementation:

    <NavigationButton [nsRouterLink]="['../../home']" android.systemIcon="ic_menu_back"></NavigationButton>

But it’s not a actual back. It pushes home page as a new page. (And when I use hardware back button, I see too many back and forward pages)


That seems intentional, if you want to go back you have to write a function and call back method in router extension.

If you don’t want to write this in each and every page, you may create a directive which you can simply embed in each page.