I've developed an web application built using ASP.NET Core Web API andAngular 4. My module bundler is Web Pack 2.
I've seen this approach of Angular Universal server side rendering without tag helper and would like to make server side rendering. In addition, I see this google tutorial ofAngular Universal, but they use "NodeJS" server, not "ASP.NET Core".
As I use "ASP.NET Core Web API" and my "Angular 4" application does not have any ".cshtml" views, so I cannot send data from controller to view through "ViewData["SpaHtml"]" from my controller:
ViewData["SpaHtml"] = prerenderResult.Html;
But I would like to use server side prerendering. I would like to add metatags into head when Search Engines see my Angular application:
import { Meta } from '@angular/platform-browser'; constructor( private metaService: Meta) { } let newText = "Foo data. This is test data!:)"; //metatags to publish this page at social nets this.metaService.addTags([ // Open Graph data { property: 'og:title', content: newText }, { property: 'og:description', content: newText }, { { property: "og:url", content: window.location.href }, { property: 'og:image', content: "http://www.freeimageslive.co.uk/files /images004/Italy_Venice_Canal_Grande.jpg" }]);
Is it possible to do without `ViewData`?
Example what I have is uploaded to a github repository.