I have implemented server side rendering in angular 6 and it is working but in social share scenario i am facing some problems. Problems are listed below.
1- I am using short url for sharing. So I have created a lazy module which reads the short url and than navigate to another lazy loaded module on the basis of type of url.
suppose types are car,bike,truck. On these route i have handelling of these Type and the view regarding its type.
Demo code-
ngOnInit() {
this.activateRoute.params.subscribe(res=>{
console.log(res);
this.getAllSharedContent(res.id);
})
}
getAllSharedContent(id) {
this.sharedUrlService.getContentFromSharedUrlId(id).subscribe(res=>{
console.log(res);
this.router.navigate(['/transport/' + new LowerCasePipe().transform(res.type) + '/' + new ReplaceWhiteSpace().transform(res.title) + '/' + new ReplaceCpIds().transform(res.id, '')], { queryParams: { page: 0 } });
})
}
I want the rendered page where i have navigated. but it is returning the index.html page.