Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 角度数据表最初向服务器发送三个请求_Angularjs_Typescript_Datatable_Angular Datatables - Fatal编程技术网

Angularjs 角度数据表最初向服务器发送三个请求

Angularjs 角度数据表最初向服务器发送三个请求,angularjs,typescript,datatable,angular-datatables,Angularjs,Typescript,Datatable,Angular Datatables,我正在使用角度数据表库。一切都很正常(正确地加载数据表中的数据),但我不知道为什么最初它会根据给定的url向服务器发送3http请求。我已经搜索过了,但没有找到任何解决方案 版本:v0.5.5 下面的代码只调用了一次,但向服务器发送了三个请求 getData() { var authorization = this.$http.defaults.headers.common["Authorization"]; var self = this

我正在使用
角度数据表
库。一切都很正常(正确地加载数据表中的数据),但我不知道为什么最初它会根据给定的url向服务器发送3
http
请求。我已经搜索过了,但没有找到任何解决方案

版本:v0.5.5

下面的代码只调用了一次,但向服务器发送了三个请求

getData() {

            var authorization = this.$http.defaults.headers.common["Authorization"];

            var self = this;
            debugger;
            this.dtOptions = this.dTOptionsBuilder.newOptions()
                .withOption('ajax',
                {
                    contentType: 'application/json',
                    url: self.url,//server url to get data
                    type: "POST",
                    headers: { 'Authorization': authorization },
                    data(data) {

                        data.dataTableModel = self.dataTableModel;
                        data.order[0].name = data.columns[data.order[0].column].data;
                        data.query = data.search.value;

                        return JSON.stringify(data);
                    },
                    error(errorResponse) {
                        console.log(errorResponse);
                    }
                })
                .withDataProp('data')
                .withOption('processing', true)
                .withOption('serverSide', true)
                .withOption('createdRow', (row, data, dataIndex) => {//row recompile

                    this.$compile(angular.element(row).contents())(this.$scope);
                })
                .withOption('headerCallback', header => {//header recompile
                    this.dtOptions.headerCompiled = true;
                    this.$compile(angular.element(header).contents())(this.$scope);

                })
                .withPaginationType("simple_numbers")
                // .withOption("scrollY", 150)
                // .withOption("Paging",false)
                .withOption("lengthMenu", [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]])
                .withBootstrap();
        }
在图中,您可以看到三个连续的请求

有什么建议吗


您是否调用
getData
3次?@MaximShoustin否。只调用1次。我已确保它只调用一次而不是3次您是否调用
getData
3次?@MaximShoustin否。只调用1次。我已确保它只调用一次而不是3次