Can't make Ionic “deeplinks” work

I’m trying to use deeplink inside an Ionic web application (not a native one).

I followed these instructions step by step.
But it seems to have absolutely no effect when entering the url (I see the home page).

app.module.ts

    @NgModule({
      declarations: [
       // ...
      ],
      imports: [
        IonicPageModule.forChild(FeedbackPage),
        BrowserModule,
        HttpModule]

feedback.ts

    @IonicPage({
      segment: 'some-path',
    })
    @Component({
      selector: 'page-feedback',
      templateUrl: 'feedback.html',
    })
    export class FeedbackPage extends HugoApiErrorsMixin implements OnInit {

Accessing http://localhost:8100/#/some-path display my home page instead of the Feedback page.
Navigating manually to the Feedback page does NOT change the displayed URL.

By the way, after browsing the posts about deeplinks, it seems that MANY people seems to complain about deeplinks not working. It seems Ionic teams wants to hide that kind of problems, it is never mentioned on documentation when something is unstable.

NOTE : I’m using ionic 3.8.0

No one for this? :frowning:

No offense to anyone here, but It’s the 4th time I post simultaneously on this forum and Stack Overflow, and I always have better results with SO. (at least someone tries to help).
Seriously, what’s the point to keep that forum alive? It only scatters useful ionic knowledge.

Don’t know if there are major differences between web/native navigation, but if it’s the same you are missing some points.

You should call: IonicModule.forRoot(MyApp) on imports of app.module.ts

MyApp should be your root component, normally app.component.ts

app.component.ts should have a property called rootPage, where you will reference the page (use string if using lazyload/deeplinks) you want to load first if no segments are added to you URL.

This rootPage should have some files:
page.ts
page.scss
page.module.ts
page.html

page.module.ts you sould declare page.ts and import IonicPageModule.forChild(Page)

page.ts must have decorator @IonicPage()

3 Likes

Hi @asamarcos, I’m glad to read your answer, because it is almost exactly what I had, but had some troubles with my deeplinks.
And after reading the officiel doc, I thought everything had changed so I try to implement what is in the documentation, but it was worst, nothing worked as I wrote in my initial post.

About what you said, it’s almost exactly what I have currently. The only differences are: I don’t have 1 module per page, but I use the global module for all my pages and I don’t use IonicPageModule.forChild(Page)

That way, deeplinks seemed to work, but… when the URL of a deeplink is displayed, it never dissapears after that. I tried to explain the problem and show code here: https://github.com/ionic-team/ionic/issues/13277

Damn I never seen a topic more confusing that using deeplinks in Ionic, seriously. No one seems to know exactly what to do in what case :slight_smile:

Thanks for you help.

1 Like

I’ve used, at least attempted to use it, and yeah it’s a complicated one. It wasn’t a necessity for me so I didn’t push the issue. Good luck!

1 Like