繁体   English   中英

ng-href 从 json 打开页面在应用程序中不起作用

[英]ng-href to open page from json not working in app

我有这个问题,当我在网络浏览器上打开但在我的 android 智能手机上打开时可以工作。

<ion-list>  
  <ion-item class="list" >
    <a class="item item-thumbnail-left" ng-href="{{x.Adress}}" ng-repeat="x in names|orderBy:'Name'" >
      <img ng-src="{{x.Image}}">
      <h2>{{x.Name}}</h2>
      <p>{{x.Local}}</p>
      <p>{{x.Descri}}</p>
    </a>
  </ion-item>
</ion-list>

 .controller('PlaylistsCtrl', function($scope, $http) { $http.get("patrocinadores.json") .success(function (response) { $scope.names = response; }); })

尝试不使用插值写入地址:例如:

并验证您的属性名称。

或者你可以尝试(不花哨):

<ion-list>  
    <ion-item class="list" >
<a class="item item-thumbnail-left" ng-click="Open(x.Adress)" ng-repeat="x in names|orderBy:'Name'" >
  <img ng-src="{{x.Image}}">
  <h2>{{x.Name}}</h2>
  <p>{{x.Local}}</p>
  <p>{{x.Descri}}</p>
</a>

在您的控制器中:

$scope.Open = function(url){
    window.open(url, '_system');
};

不要忘记在您的“a”标签中,您需要将目标属性设置为“系统”以使用默认系统浏览器而不是嵌入离子视图加载或打开您的链接。

我希望这可以帮助你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM