Javascript | How to call ajax in DevExtreme component using angularjs

Author - Neelam
23.02.2017
|
0 Comments
|
var folderApp = angular.module("folder", ["dx"]);
folderApp.controller("folderController", ["$scope", "$http", function($scope, $http) {

    $scope.gridSettings = {

        columns: [{
            dataField: "myObjectName",
            caption: "Name",
        } {
            dataField: "myObjectEmail",
            caption: "Email",
        }],

        dataSource: new DevExpress.data.CustomStore({
            load: function(loadOptions) {
                return $http({
                    method: "GET",
                    url: " ”;
                    headers: {},
                }).then(function(data) {
                    return {
                        data: data.data,
                        totalCount: data.data.length
                    };
                });
            }
        })
    };
}]);

$http : This service is used to make a request to the server and it returns a response. But In devextreme we need to return the result of the Angular $http method in the “load”, “insert”, “update”, “remove” methods of CustomStore.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *