I'm trying to get the hang of Angular2 but I'm stuck with the following:
I started a new ionic project, added a page login, so far so good.
I found the following post on how-to set headers for every request: Angular2 - set headers for every request
This is what my app.module.ts looks like:
import { NgModule } from '@angular/core';
import {HTTP_PROVIDERS, Headers, Http, BaseRequestOptions} from 'angular2/http';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { Page1 } from '../pages/page1/page1';
import { LoginPage } from '../pages/login-page/login-page';
class CustomRequestOptions extends BaseRequestOptions {
constructor () {
super();
this.headers.append('Content-Type', 'application/json');
}
}
@NgModule({
declarations: [
MyApp,
Page1,
LoginPage
],
imports: [
//HttpModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
Page1,
LoginPage
],
providers: []
})
export class AppModule {}
As soon as I add the class CustomRequestOptions part, I'm getting this error message in ionic serve
Error: Could not resolve 'rxjs/observable/PromiseObservable' from /Users/stijn/node_modules/angular2/src/facade/async.js
I've already started over, first time I tried with a service around the Http (see accepted answer in link above. But got the same error message.
Where is this error message coming from? Some configuration error?