i'm a little newie in AngularJS and NodeJS, i have an app that i want to load some data from a mysql db and load that data through Node server and Angular framework, my question is, how can i load the data to show it in a page before its loaded? i'm tryng it but always i get undefined from json var.

This is my code:

```
var app = angular.module('pedidos',[]);
app.service('adminPedidos',function($http){
    this.getAll = function(){
        var data =[];
        var req = {
            method: 'GET',
            url: 'http://localhost:3000/all',
        };
        return $http(req).then(function(response, status, headers, config) {
            return response;
        }).error(function(response, status, headers, config) {
            alert(response+" "+status);
        });
    };
});

```

and the controller have the following sentence:

```
app.controller('Main'['$scope','$http','adminPedidos',function($scope,$http,$adminPedidos){
    this.json = [];
    this.json = $adminPedidos.json;
    console.log(this.json);
}]);

```

Also in html i have this:

```
<section class="container" ng-controller="Main as controller">
    <section ng-repeat="items in controller.json" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
        <div data-id="{{items.id}}">
            <span class="col-lg-3 col-md-3 col-sm-6 col-xs-12" name="name">{{items.name}}</span>
            <span class="col-lg-3 col-md-3 col-sm-6 col-xs-12" name="link"><a href="{{item.link}}">{{items.link}}</a></span>
            <span class="col-lg-2 col-md-2 col-sm-6 col-xs-12" name="price">{{items.price}}</span>
            <span class="col-lg-1 col-md-1 col-sm-6 col-xs-12" name="quantity">{{items.quantity}}</span>
        </div>
        <div class="col-lg-offset-1 col-md-offset-1 col-lg-1 col-md-2 col-sm-6 col-xs-6"><button id="edit" class="btn btn-warning">Editar</button></div>
        <div class="col-lg-1 col-md-2 col-sm-6 col-xs-6"><button id="delete" class="btn btn-danger">Borrar</button></div>
    </section>
</section>

```