1

I tried to parse json using below code but it is displaying a blank page.

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
  $http.get("http:krispypapad.herokuapp.com/fetch_article").success(function (response) {   
      $scope.myWelcome = data.response;

    });  
});
georgeawg
  • 48,608
  • 13
  • 72
  • 95
venugopal
  • 11
  • 1
  • See [Why are angular $http success/error methods deprecated? Removed from v1.6?](http://stackoverflow.com/a/35331339/5535245). – georgeawg Dec 27 '16 at 19:02

2 Answers2

1

I think there is typo with the URL you are using:

http:krispypapad.herokuapp.com instead http://krispypapad.herokuapp.com you are missing a couple of //

This is how your code will look like:

var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
  $http.get("http://krispypapad.herokuapp.com/fetch_article").success(function (response) {   
      $scope.myWelcome = response; //<-- no .data is required

    });  
});
Dalorzo
  • 19,834
  • 7
  • 55
  • 102
0

You have a typo in the URL, it should be like this:

http://krispypapad.herokuapp.com/whatever

Also you should use response.data not data.response

amrdruid
  • 951
  • 13
  • 24