Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49167

ionicLoading.hide() not working

$
0
0

@Takeda wrote:

Hi All, I created the service below and not sure where should I add the ionicLoading functionality?

I put in the code below (you will see it commented out) and it works but the ionicLoading.hide(), don't.

angular.module('starter')
.service('TwitterService',['$http','$ionicLoading','$cordovaGeolocation', function($http, $ionicLoading, $cordovaGeolocation){

var lat = "";
var long = "";

var geoSettings = {frequency: 1000, timeout: 30000, enableHighAccuracy: false};

$cordovaGeolocation.getCurrentPosition(geoSettings).
then(function (position) {
    lat = position.coords.latitude;
    long = position.coords.longitude;
    console.log("Twitter latitude: "+lat);
    console.log("Twitter longitude: "+long);

},
    function error(error) {
        alert('code: ' + error.code + '\n' +
        'message: ' + error.message + '\n');
    }
);

this.getTwitter = function(hashtag){

	console.log("Hashtag: "+hashtag);
	//$ionicLoading.show();

	return $http({
		method: 'GET',
		url: 'https://catastrophe-advisor-twitter.mybluemix.net/api/twitter/count?lat='+lat+'&lng='+long+'&keywords='+hashtag+'',
		data: hashtag
	});
	ionicLoading.hide();
}

}]);

Posts: 5

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 49167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>