How to extend angular 2 http class in Angular 2 final

前端 未结 6 1219
别跟我提以往
别跟我提以往 2020-12-09 03:39

I\'m trying to extent angular 2 http class to be able to handle global errors and set up headers for my secureHttp service. I found some solutions but it doesn\'t work with

6条回答
  •  我在风中等你
    2020-12-09 03:48

    From Angular 4.3, we don't need to extends http anymore. Instead, we can use HttpInterceptor and HttpClient to archive all these stuffs.

    It's similar and easier than using Http.

    I migrated to HttpClient in about 2 hours.

    Detail is here

提交回复
热议问题