TypeError: error.json is not a function

前端 未结 5 1654
陌清茗
陌清茗 2021-01-04 20:37

Edit: Read the part at the end of the question!

I get this error:

My service code:

import { Http, Response, Headers } from \         


        
5条回答
  •  粉色の甜心
    2021-01-04 21:36

    Just Make Changes into your app.module.ts file

    import { HttpModule} from "@angular/http";

    @NgModule({

    declarations: [

    ---- ],
    imports: [ BrowserModule, HttpModule],

    providers: [
        DataService
    ],   
    bootstrap: [
       AppComponent
    ]})
    

    This will fix your issue now in updated version of angular the methods are rewritten.

提交回复
热议问题