angularjs asp.net json datetime parser

641 查看

http://stackoverflow.com/ques...

http://stackoverflow.com/ques...


$http.post(url, data, {
    transformResponse: function (value) {
        return JSON.parse(value, function (key, value) {
            if (typeof value === 'string') {
                var d = /^\/Date\((\d*)\)\/$/.exec(value);
                return (d) ? new Date(+d[1]) : value;
            }
            return value;
        });
    }
})