Javascript | How to call ajax in DevExtreme component using angularjs

|
| By Webner
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.

Leave a Reply

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