Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 - No provider for Jsonp

Tags:

angular

getting error:

inline template:16:8 caused by: No provider for Jsonp!
ORIGINAL EXCEPTION: No provider for Jsonp!

I am importing the 'HttpModule' directly into the module that the component is a part of.

like image 515
Nik Avatar asked Sep 13 '16 15:09

Nik


1 Answers

You need to import and declare JsonpModule as shown below,

import { HttpModule, JsonpModule } from '@angular/http';

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    JsonpModule
  ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
like image 124
Nikhil Shah Avatar answered Oct 11 '22 08:10

Nikhil Shah