Write http interceptor as class

后端 未结 5 2077
情深已故
情深已故 2020-12-15 11:49

I\'m having trouble writing an angular http interceptor in plain TypeScript. The code I\'m trying to convert is the following:

.config([\'$httpProvider\', fu         


        
5条回答
  •  暖寄归人
    2020-12-15 12:02

    You need to do: public response = (response) => {}

    public responseError = (rejection) => { }

    Because in other way your 'this' will be undefined. To understand why you need this : https://www.youtube.com/watch?v=tvocUcbCupA&hd=1

提交回复
热议问题