pawanjee
pawanjee

Reputation: 69

Link not opening in system browser in ionic

I am in process of making an ionic application and trying to open a link in app using cordova.InAppBrowser but I get this error when I click it

Application Error
net::ERR_FILE_NOT_FOUND (file:///android_assets/www/(item.url))

MY Code

 <div ng-repeat="item in object.torrents" class="button-bar bar-dark" >
  <a onclick="window.open('(item.url)', '_system' );" class="button">Open</a>

</div>

Upvotes: 3

Views: 689

Answers (3)

pawanjee
pawanjee

Reputation: 69

Html Code 
<a ng-click = openUrl(item.url); class="button">button</a>

js Code

$scope.openUrl = function(url) {
    //alert(url);
    window.open(url, '_blank', 'location=no');
  }

Upvotes: 1

sam
sam

Reputation: 698

Use ng-click instead of onclick

Upvotes: 0

M. Junaid Salaat
M. Junaid Salaat

Reputation: 3783

You are not using the angular syntax for object property retrieval.

Try this.

<div ng-repeat="item in object.torrents" class="button-bar bar-dark" >
  <a onclick="cordova.InAppBrowser.open('{{item.url}}', '_system');" class="button">Open</a>

</div>

Upvotes: 1

Related Questions