Mohamed Ben HENDA Mohamed Ben HENDA - 1 year ago 983
AngularJS Question

import HTTP_PROVIDERS in app.component.ts

When I try to import the HTTP_PROVIDERS from angular/http I have this error:

Error:(3, 9) TS2305: Module '"projectname/node_modules/@angular/http/index"' has no exported member 'HTTP_PROVIDERS'.

this is my file content:

import { Component } from '@angular/core';
import {GithubService} from './services/github.service';
import {HTTP_PROVIDERS} from '@angular/http';

selector: 'my-app',
template: '<h1>My First Angular 2 App</h1><Profile></Profile>',
providers: [ HTTP_PROVIDERS, GithubService ]

export class AppComponent { }

Answer Source

If you use RC.6 you might want to import the HttpModule instead:

  imports: [HttpModule],
class AppModule {}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download