Ionic App - Cordova inApp Browser

I have created an ionic android app that reads data from the database. One of the fields in the database is the website url. I'm doing data binding where I can display the url using:

{{accommodation.website}}

. I want to be able to use this to display an external web page. Unfortunately this is not working using this code:

 <a ng-href="#" target="_self" onclick="window.open('{{accommodation.website}}','_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>

and as a result it displays :

http://localhost:8100/%7B%7Baccommodation.website%7D%7D
Cannot GET /%7B%7Baccommodation.website%7D%7D

But when I use:

 <a ng-href="#" target="_self" onclick="window.open('http://www.w3schools.com/angular/ng_ng-href.asp','_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>

It works fine on android phone. Instead of hard coding the url, I want to use data binding as I am working with ion-list. I spent all day trying to fix this. Please help.

Answers


Hope this will help you, for detail, go to Nic's Blog, and check out comments. Regards!

<a ng-href="{{accommodation.website}}" target="_self" onclick="window.open(this.href,'_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>

First, use ng-click, not onclick, but that is beside the point since you should just be using ng-href="{{accommodation.website}}"


Need Your Help

Least number of whole tiles to use to fill a space

excel excel-vba excel-formula combinations mathematical-optimization vba

Per this thread, Tim makes a good point so trying this again. He writes,