【发布时间】:2016-07-11 15:50:01
【问题描述】:
我正在使用 Ionic 框架开发 android app.simple json 文件在我的应用程序中不起作用!相同的应用程序仅适用于本地浏览器,当我在我的手机中运行此应用程序时,该应用程序无法使用 $http 处理 json 文件。我收到此错误,
GET http://localhost:8383/LoginCtrl/www/js/namerecords.jsonnet::ERR_CONNECTION_REFUSED
How to work with json file in mobile,below i attached my code.
Controller.js
app.controller('recordsCtrl',function($scope,$http){
$http.get('http://localhost:8383/LoginCtrl/www/js/namerecords.json')
.success(function(response){
console.log(response.records);
$scope.persons = response.records;
});
});
【问题讨论】:
-
尝试包含名为
whitelist的插件 -
您需要将“localhost”更改为您的服务器地址!
标签: android json ionic-framework