Search code examples
ionic-frameworkionic4

Deeplink in Ionic V4?


We are using Ionic 4 with lazy loading. My app routing works by app.routing.module.ts file. How to use deep link to open app from external link like email or sms?


Solution

  • It seems you didn't type this into Google first so this question is likely going to be closed shortly.

    Ionic provide a deep linking library:

    It's used like this:

    this.deeplinks.routeWithNavController(this.navController, {
      '/about-us': AboutPage,
      '/products/:productId': ProductPage
    }).subscribe(match => {
        // match.$route - the route we matched, which is the matched entry from the arguments to route()
        // match.$args - the args passed in the link
        // match.$link - the full link data
        console.log('Successfully matched route', match);
      }, nomatch => {
        // nomatch.$link - the full link data
        console.error('Got a deeplink that didn\'t match', nomatch);
      });
    

    You are supposed to do as much research as you can on your own before you open a question on StackOverflow. People are happy to help but they usually want to see you have tried for yourself as you are just giving your job to somebody else otherwise.