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

$ionicLoading not working on $scope

$
0
0

@Ckpk wrote:

Try to use $ionicLoading directive, but cannot make it works.

I am showing the loading screen when someone clicked on the link while the link process to API, the loading screen will shown before its completed and return some data. Someone please tell me where i am doing it wrong.

controller.js

angular.module('ionicApp.controllers', [])

.controller('DashCtrl', function($scope, $http, $ionicScrollDelegate, $ionicLoading) {
    $scope.show = function() {
      $ionicLoading.show({
        content: 'Loading',
        animation: 'fade-in',
        showBackdrop: true,
        maxWidth: 200,
        showDelay: 0
      });
    };

    $scope.hide = function(){
          $ionicLoading.hide();
    };

    //scope to show posts by specific user
    $scope.byUser = function(uid){
         $scope.show($ionicLoading);
         var xhr = $http({
            method: 'post',
            url: 'http://www.mywebsite.com/api/lists.php?uid='+uid
         });
         xhr.success(function(data){
             $scope.data = data.data;
         });
        $ionicScrollDelegate.scrollTop();
        $scope.hide($ionicLoading);
    }
});

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49355

Latest Images

Trending Articles



Latest Images

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