angular.js - How does $http in angular filter the data obtained after a successful request?
高洛峰
高洛峰 2017-05-15 16:59:10
0
1
545

As shown in the picture. The data actually returned to me by the backend is in the second layer of data.
How should I do a layer of data processing globally? Where is the best place to do it?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
伊谢尔伦
angular.module('my', [])
        .config(function ($httpProvider) {
            $httpProvider.interceptors.push(function () {
                return {
                    response: function (response) {
                        if (200 === response.data.code) {
                            response.data = response.data.data;
                        }
                        return response;
                    }
                }
            });
        })
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template