Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Here is my controller

(function () {

var manageBackOrdersController = function ($scope, $http, DTOptionsBuilder, DTColumnBuilder) {


    $http({
        url: '/Customer/ManageBackOrders/firstJson',
        method: "GET",
        params: {}
    }).success(function (data) {
        var JSON = data;
        $scope.data = JSON;
        //alert(JSON)

    });

    $scope.dtOptions = DTOptionsBuilder.fromSource('/Customer/ManageBackOrders/firstJson')
           .withPaginationType('full_numbers');
    $scope.dtColumns = [
        DTColumnBuilder.newColumn('Cust').withTitle('Customer'),
    ];
}

manageBackOrdersController.$inject = ['$scope', '$http', 'DTOptionsBuilder', 'DTColumnBuilder'];

angular.module('customersApp').controller('manageBackOrdersController', manageBackOrdersController)


}());

I am trying to avoid getting my data twice. I have to make the first call to generate a drop down menu on my page. I would like to use my #scope.data to do something like this:

$scope.dtOptions = DTOptionsBuilder.fromSource($scope.data)
  .withPaginationType('full_numbers');

Doing this as it is now doesn't work.

share

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.