Popularni postovi

Sunday, 29 June 2014

$http get from controller

'use strict';
app.controller('ordersController', ['$http','$scope', 'ordersService', function ($http, $scope, ordersService) {

    $scope.orders = [];

    var serviceBase = 'http://localhost:26264/';


      $scope.orders = $http.get(serviceBase + 'api/orders')
    .success(function (data, status, headers, config) {
        $scope.orders = data;
        console.log(data);
        return data;
    }).error(function (data, status, headers, config) {
        alert("error");
        return status;
    });


}]);

No comments:

Post a Comment