angular2 xhrfields withcredentials true

前端 未结 6 2116
醉话见心
醉话见心 2020-12-03 23:24

I am trying to login to a system. In angular 1, there was ways to set

withCredentials:true

But I could not find a working solution in angu

6条回答
  •  感情败类
    2020-12-04 00:11

    If anyone is using plain JS, based on cexbrayat's answer:

    app.Service = ng.core
        .Class({
            constructor: [ng.http.Http, function(Http) {
                this.http = Http;
                var _build = this.http._backend._browserXHR.build;
                this.http._backend._browserXHR.build = function() {
                    var _xhr = _build();
                    _xhr.withCredentials = true;
                    return _xhr;
                };
            }],
    

提交回复
热议问题