0

I get an error in Chrome saying Error fetching feed: Undefined, 0. Any advice?

My angular code is:

        // Begin SimpleController, with data
        demoApp.controller('SimpleController', function($scope, $http){
            var url = "http://www.grabapper.com/api/v1/iosapps.json";

            $http.jsonp(url).
                success(function(data,status,headers,config){
                    $scope.feed = {
                        title: 'DailyJS',
                        items: data
                    };
                }).
                error (function(data,status,headers,config){
                    console.error('Error fetching feed:', data,status);
                });

        });
        // End SimpleController

all.html:

<li ng-repeat="item in feed.items">

            {{item.name}}

    </li>

1 Answer 1

0

Because you are calling cross domain API in your client code. You may checkout this solution.

Here is the code snippet which might shed some light on

$http.defaults.useXDomain = true;
var data =$resource(url);
if(data){
    $scope.feed = {
        title: 'DailyJS',
        items: data
    };
}else{
    console.error('Error fetching feed:', data);
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.