4

angular2 import HTTP_PROVIDERS

error message >> @angular/http/index"' has no exported member 'HTTP_PROVIDERS'.

import { Component } from '@angular/core';
import {NoticeService} from './products/product.service';
import {HTTP_PROVIDERS} from '@angular/http';
import 'rxjs/Rx';

@Component({
  selector: 'my-app',
  template: `
    <h1>Hello {{name}}</h1>
    <pm-products></pm-products>
  `,
  providers: [NoticeService, HTTP_PROVIDERS] 
})

1 Answer 1

12

You don't need HTTP_PROVIDERS anymore (deprecated). Import the http module instead.

import { NgModule } from '@angular/core';
import {  HttpModule } from '@angular/http';
import { BrowserModule  } from '@angular/platform-browser';

import { AppComponent } from './app.component';

@NgModule({
    imports: [
        BrowserModule,
        HttpModule  
        ],
    declarations: [AppComponent],
    providers: [],
    bootstrap: [AppComponent],
})
export class AppModule { }
Sign up to request clarification or add additional context in comments.

1 Comment

As I know right it's necessary to use http.get and http.post methods?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.