如何从离子中的 $http.get 获得 json 结果

how to get a json result from $http.get in ionic

我 return 来自服务器的数据有一个大问题,$scope.$apply 函数剥离了值,我无法操作我的数据。

从服务器return编辑的数据:

angular.callbacks._0([{'Empresa':'Solução Informática','Email':'vinicius.cardoso@solucaorp.com.br','Filial':'1','Pontos':'504,23'},{'Empresa':'Keiken Sushi Bar e Restaurante ','Email':'cardosin@gmail.com','Filial':'7','Pontos':'154,48'}])

来自应用程序的打印:

来自控制器的代码:

.controller('meusPontosCtrl', function($scope, $http, $localStorage,$ionicLoading, $timeout, $ionicPopup,$state,$stateParams,$window, MeusPontos,pontos) {
    $scope.$on('$ionicView.enter', function(){
        $http.get('https://ssl-386475.uni5.net/bonus/ClienteIOS/meuspontos?id='+$localStorage.user.Id+'&callback=JSON_CALLBACK')
        .success(function(response, status, headers, config){

            $ionicLoading.show({
                content: 'Carregando Dados',
                animation: 'fade-in',
                showBackdrop: true,
                maxWidth: 200,
                showDelay: 0
            });
            $timeout(function () {
                $ionicLoading.hide();
                //response = response.replace('angular.callbacks._0(','').replace(')','').replace('""','');
                $scope.$apply(function () {
                    $scope.pontos = response
                    console.log(response)
                })
            }, 1000);
        })
    })
})

来自 html 模板的代码:

<ion-view title="Meus Pontos">
<ion-content overflow-scroll="true" class="has-header" ng-controller="meusPontosCtrl">
    <ion-list>
        <ion-item ng-repeat="item in pontos track by $index"  type="item-text-wrap" data-ng-click="selecionado(item)" >
             <img src="img/ic_action11.png" style="float:left; width:48px; heigth:48px; margin-right:24px">
            <h2>Creditos R$ {{item.Pontos}}</h2>
             <p>{{item.Empresa}}</p>
            <p>{{item.Email}}</p>

        </ion-item>
    </ion-list>
</ion-content>

如果您希望 $http 服务解析您的 json,您必须从您的服务器 ("application/json") 发送正确的 header。