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';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1><Profile></Profile>',
providers: [ HTTP_PROVIDERS, GithubService ]
})
export class AppComponent { }
If you use >= RC.5 add HttpModule
to imports
in @NgModule
instead:
@NgModule({
imports: [HttpModule],
...
})
class AppModule {}
What if i want to write an auth-interceptor using e.g.
import { provideAuth } from 'angular2-jwt';
...
bootstrap(App, [
HTTP_PROVIDERS,
provideAuth({
headerName: YOUR_HEADER_NAME,
headerPrefix: YOUR_HEADER_PREFIX,
tokenName: YOUR_TOKEN_NAME,
tokenGetter: YOUR_TOKEN_GETTER_FUNCTION,
globalHeaders: [{'Content-Type':'application/json'}],
noJwtError: true,
noTokenScheme: true
})
])
First, there is no HTTP_PROVIDERS in @angular/http. Second, there is no bootstrap in @angular/platform-browser-dynamic
Everywhere you find simillar thing s when you want to write your auth interceptor, but nowhere it is written how to do it whith the released version of angular 2 :( All examples are just not working anymore :( Can anyone tell me how to write an auth interceptor with hte RELEASED version of angular2, i.e. @angular/*:2.0.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With