title: How to get canGoBack functionality in Ionic 5?
body: <p>I'm trying to put a back button in Ionic app and to hide the back button when it's in the root, which the root is not fixed and can be changed based on the flow. I found the following code here:</p>
  
  <pre><code>...
  constructor(
      private router: Router,
      private ionRouterOutlet: IonRouterOutlet
  ) {
  
  }
  
  ngOnInit() {
      this.canGoBack    = this.ionRouterOutlet.canGoBack();
  ...
  </code></pre>
  
  <p>It would be nice if it works but IonRouterOutlet is component and cannot be injected to another component like this. Any idea about how can it be done in Ionic 5 with angular?</p>