Remove hashbangs from URL


#1

Hello Im new to ionic. seems like when I define static URL’s instead of using deeplink config. we get hashbangs in URL. This seems very inappropriate for SEO point of view. Hence, I investigated about this but couldn’t find a proper solution for ionic 2. I tried this https://github.com/ionic-team/ionic/issues/11036
But it doesn’t seems to work for ionic 2.


#2

Have a look to


#3

Hey @reedrichards - I tried this approach but the problem is after adding this I am not able to navigate to any other pages :frowning:

Fyi: My code use lazyloading


#4

@chats1986 try with an incognito browser window, do you face the same error?

might be a cache problem see https://forum.ionicframework.com/t/uncaught-in-promise-error-loading-chunk-20-failed/


#5

I did try that approach… but its the same issue again…when I remove locationStrategy: ‘path’ from app.module.ts the # comes back in the url but works fine :frowning:

One more issue that I have observed here is when using tabs in ionic 3 constructor is loading twice and the issue is still open on github :frowning: looks like they are busy fixing ionic 4 but we are left no where with both things not working for us !


#6

@chats1986 honestly I don’t know, I could confirm that the locationStrategy set to path just worked fine when I was using Ionic v3 (except for refreshing the page maybe but that isn’t your problem) and of course now that I have migrated to v4, it isn’t needed anymore since the routing is inherited from the Angular one

sorry don’t have any other ideas


#7

Alright will try that… thanks David :slight_smile:
if you have some time I am stuck with another issue your help is needed …On Ionic 4 I am not able to understand on how to get the current selected tab… below is the html code …

//HTML
<ion-tabs #myTabs (ionChange)="tabSwitched(myTabs)"></ion-tabs>
//TS 
tabSwitched(myTabs) {
    console.log(myTabs.getSelected());
    // this.events.publish('refresh:channels', Date.now());
  }
//Output comes up like this and I am not sure how to get through the selected Id.

Is this the right approach :slight_smile: or am I doing something wrong here…requesting you to please help!


#8

I don’t have that much experience in tabs, you probably better open a separate issue/post


#9

Okie. Thanks for replying!


#10

@reedrichards found the solution…!

All, if anyone is looking for on how to get the current selected tab …find the answer here - [Ionic 4] - Get current Tab selected

Thanks !