Trigger backbutton from component


#1

Hi there,

I’ve got an app where I need to navigate to a page with an url('<a href="#/home/myPage/' + id + '">OpenPage</a>'). I think navigating through url’s is the same action as navCtrl.setRoot('myPage'), meaning there are no pages in the history. When opening this page, I would like to be able to go back to the previous page with the state restored. I’ve tried navCtrl.pop(), but since there’s no pages in the backstack I get an error.

However, when I press the back button in Android I get the exact action I would like to happen, but I can not find how to trigger the backbutton from code. Is this possible, and if not, how can I achieve the described scenario? Navigating without url’s is not an option, and I do really need the <a href> since I substract url’s from text and open this url in the other page in my app.


#2

Why?[quote=“raym0nd, post:1, topic:96834”]
I do really need the <a href> since I substract url’s from text and open this url in the other page in my app.
[/quote]

Then you could also parse the url to understand where it should go and do it the Ionic way.


#3

Sayeth the 3.5.0 CHANGELOG:

For now, we don’t recommend using href attributes in the application. Using the navPush and navPop directives is a better option for now while URL support is being built-out.


#4

The reason for this is:

I retrieve twitter streams. I want to open the url’s in the message in an inAppBrowser. Since I don’t know where and how many url’s in a twitter message, I find the url with regex and then add the <a href>