Failed to call service method on emulator


#1

Hi,

I’m facing issues with service method call in emulator.
Below is my template, which is calling a controller method ‘loadFeed()’ of FeedCtrl controller, which inturn calls service method parseFeed() of FeedService.

    <ion-side-menus ng-controller="FeedCtrl">
            
      <ion-side-menu side="left">
          .....
            <ion-list>
                <ion-item ui-sref="AccountDetail.News" ng-click="loadFeed()">News</ion-item>
            </ion-list>
          ......       
      </ion-side-menu>
<ion-side-menus>

Controller :

 app.controller("FeedCtrl", ['$scope','FeedService', function ($scope,Feed) {    
    $scope.loadButonText="Load";
    $scope.feedLenght = 0;
    $scope.feedSrc="http://feeds2.feedburner.com/Mashable";
    console.log('in Feed controller'); //LINE1
    $scope.loadFeed=function(){
        console.log('in FeedCtrl : inside loadFeed method');  //LINE2
        Feed.parseFeed($scope.feedSrc).then(function(res){
            console.log('in FeedCtrl: calling parseFeed service method'); //LINE3
            $scope.feeds=res.data.responseData.feed.entries;
            $scope.feedLength = $scope.feeds.length;          
            console.log('setting feeds value, no of feeds :'+$scope.feeds.length);
            
        });
    }
}]);

FeedService :

app.factory('FeedService',['$http',function($http){
return {
        parseFeed : function(url){
        return $http.jsonp('http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));
        }
    }
}]);

Its perfectly working in browser, writing LINE1,LINE2 and LINE3 (console.debug lines in controller) to the console. But on emulator its not going into parseFeed() method in the controller.

Anyone please help on this.

Thanks in advance.
-Murthy VVR