angularjs - Getting data from a web service with Angular.js -
im trying data in json format remote ws using angular , im having trouble. data comes web service correctly cant use inside controller. why that? angular code: var booksjson; var app = angular.module('booksinventoryapp',[]); // data ws app.run(function ($http) { $http.get("https://some_api_path").success(function (data) { booksjson = data; console.log(data); //working }); }); app.controller('booksctrl', function ($scope) { $scope.data = booksjson; console.log($scope.data); //not working }); html: <section ng-controller="booksctrl"> <h2 ng-repeat="book in data">{{book.name}}</h2> </section> you should put $http.get inside controller. also, web service returns object not array. ng-repeat should this: book in data.books here working example: var app = angular.module('booksinventoryapp', []); app.controller('booksctrl', function($scope, $...