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.

I'm trying to create graph in angularjs. it's working fine but i don't know, how can i bind data from json url in shipmenttracking variable. please help me.

myApp.controller('AppCtrl', ['$scope', '$filter', 'Data', function ($scope, $filter, Data) {

    // Defining app scope
    $scope.app = {}
    $scope.app.data = Data;
    $scope.app.message = "In AppCtrl";

    // Define table data
    var shipmenttracking = [{ "OrderNumber": "SA00887342", "Airwaybill": "2013-09-05 12:12:36", "Status": "Postpayment", "Elapsed": "Puma" }];


    $scope.app.shipmenttracking = shipmenttracking;

} ]);
share|improve this question

1 Answer 1

Here is the code to get JSON object response from URL

myApp.controller('AppCtrl', ['$scope', '$filter', 'Data', function ($scope, $filter, $http, Data) {

    // Defining app scope
    $scope.app = {}
    $scope.app.data = Data;
    $scope.app.message = "In AppCtrl";

    var configObject = {
        method : 'GET',
        url : '<page-name-goes-here>'
        reponseType : 'text/javascript'
        };


        $http(configObject)
        .success(function(data){
            $scope.app.shipmenttracking = data;
        });

} ]);
share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.