 <p>The problem is that your data coming asynchronously but you try save them synchronously. Step by step:</p> <ol> <li>You define variable trail = [] </li> <li>You return trail variable to controller</li> <li>Server responds with data (but you already return trail)</li> </ol> <p>You can solve this problem by using next code:</p> <pre><code>app.service("dataService", function ($http, $routeParams){ this.getSingleTrail = function (){ var trail = []; return $http.get("http://localhost:8080/DMW-skeleton-1.0/trail/findTrailByTrailId/" + $routeParams.trailId); }}) app.controller("searchTrailsCtrl", function ($scope, dataService ) { $scope.trail; dataService.getSingleTrail().success(function(data){ $scope.trail = data; }); }) </code></pre>