当我在视图中输入jsonp函数不会将数据附加到列表时,我遇到了这个问题,当我刷新离子实验室页面时,数据被附加到列表中.. bellow是服务的代码和控制器...感谢adivice 功能进入视图
$state.go("app.meusPontos")
控制器
.controller('meusPontosCtrl', function($scope, $http, $localStorage,$ionicLoading, $timeout, $ionicPopup,$state, MeusPontos,$stateParams,$window) {
MeusPontos.getPontos().success(function(response){
$ionicLoading.show({
content: 'Carregando Dados',
animation: 'fade-in',
showBackdrop: true,
maxWidth: 200,
showDelay: 0
});
$timeout(function () {
$ionicLoading.hide();
console.log(response)
$scope.pontos = response;
}, 500);
}).error(function(response){
console.log(response)
alert("Erro ao Carregar Dados")
})
})
Service
angular.module('app.services', [])
.factory('MeusPontos', function($http, $localStorage,$state) {
return {
getPontos: function(){
return $http.jsonp('https://ssl-386475.uni5.net/bonus/ClienteIOS/MeusPontos?id='+$localStorage.user.Id)
}
}
})