After an afternoon of searching, I still can't find a workable solution to this problem.
The problem is that I have some dynamic data retrieved from a backend api that has some urls in i.e. html anchor links. The links open fine, but when I try to go back to the app by tapping the back button, the app always restarts and hence throws me back to the login screen, which would be very annoying to the end users.
I need the back button to go back to the previous page that the user was on.
I've tried various incarnations of attributes, suggested by a whole range of forum posts, but none of them solve the problem:
<a href="https://someurl.com" class="content__link" target="_blank">My website</a>
<a href="#" data-link="https://someurl.com" ng-click="goTolink($event)" class="content__link">My website</a>
<a href="#" data-link="https://someurl.com" onclick="goTolink('https://someurl.com')" class="content__link">My website</a>
<a href="#" onclick="window.open('https://someurl.com', '_system', 'location=yes')" class="content__link">My website</a>
The goTolink function is:
goTolink(event): void {
if (event.currentTarget
&& event.currentTarget.attributes['data-link']) {
this.iab.create(event.currentTarget.attributes['data-link'], "_blank", "location=true");
}
}
I have several console.log messages in there too, but nothing is showing in the console, so it can't be being called.
Any suggestions of how I can tap the back button and go back to the previous app page without the app restarting are very welcome.