Ionic 4. How to programmaticaly navigate back with Angular Router

Hi, i’m making PWA, and I need navigate back (with back transitions) to custom route (not parent).
With button all works

<ion-button [routerLink]="['','someroute']" routerDirection="back">
        <ion-icon slot="icon-only" name="arrow-back"></ion-icon>

But how can I do it with router.navigate()?
There is Location.back(), but it’s not good when current route was first (users can open my app not at root route, and Location.back() will return them to their history)

use ionic’s NavController

Import NavController in your ts

import { NavController } from ‘@ionic/angular’;

Add it to your constructor

contructor( private navCtrl: NavController ){}

Use it in your method

goBack() {

That should do the trick. you can also follow the process as described here

I would prefer to use “navigateBack” instead of “back” in some case.