I have a problem with my universal project:
I have the following service:
public getData(): Observable<Article[]> {
return this.getJson(this.relativeUrl).map(response => {
const data = response.json();
return data.map((item) => new Article().deserialize(item));
})
.catch(this.handleError);
}
And I make the following call:
private getArticles () {
this.articleService
.getData()
.subscribe(
(articles) => this.articles = articles,
error => this.errorMessage = <any>error
)
}
This works fine in my normal Angular project, however it fails if I include the ServerModule for Angular-Universal. Does somebody know where the problem is ?
import {NgModule} from '@angular/core';
//ERROR IF: import {ServerModule} from '@angular/platform-server';
import {BrowserModule} from '@angular/platform-browser';
import {RouterModule, Routes} from '@angular/router';
import {HttpModule} from "@angular/http";
...
imports: [
RouterModule.forRoot(
appRoutes,
{enableTracing: true}
),
BrowserModule.withServerTransition({
appId: 'ng-cli-universal'
}),
HttpModule /* ERROR IF; , ServerModule*/
],