Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 4 server side rendering in Asp.Net MVC 5 Framework (non Core)

I'm trying to set up a project in Asp.Net 4.5.2 (VS2017) with Angular 4.
All examples seem to use Asp.Net Core, but we're trying not to jump into .NET Core just yet, if possible.
We would like to have server side rendering though, samples seem to use this asp-prerender-module attribute from "Microsoft ASP.NET Core JavaScript Services".
Is it possible to render angular 4 server side with MVC 5?

like image 686
pauloya Avatar asked Jun 28 '17 13:06

pauloya


People also ask

Can Angular be used with ASP NET MVC?

To load Angular in ASP.NET MVC, include the script references of Angular core modules and Syncfusion JavaScript asset files in _Layout file , and load the component in index. cshtml like the following code snippets.

Can Angular be used for server-side rendering?

Angular Universal executes on the server-side by generating static pages and later are sent to the client browser for display. Thus, Angular Universal renders the app more quickly and allows users to view the application's layout.

Is Net MVC server-side rendering?

ASP.NET Core MVC is a server-side MVC framework. In a server-side application the client's request to view a page depends on the server delivering the correct content for that specific page (HTML, CSS, files, etc.) to the client. The client then renders this content for the user.

Can we use Angular in asp net?

The updated Angular project template provides a convenient starting point for ASP.NET Core apps using Angular and the Angular CLI to implement a rich, client-side user interface (UI). The template is equivalent to creating an ASP.NET Core project to act as an API backend and an Angular CLI project to act as a UI.


1 Answers

Officially there is no Asp.Net Framework (non Core) support.
As stated in https://universal.angular.io/overview/:

In addition to node.js, however, Angular Universal has ASP.NET Core support. In the near future we hope to add support for Java, PHP and Python

EDIT: "Microsoft ASP.NET Core JavaScript Services" only supports ASP.NET Core which means the site needs to deployed ASP.NET Core style. But this all can run in .NET 4.5.2 so you can still reference your good old .NET Framework libraries in your project.

like image 62
pauloya Avatar answered Sep 21 '22 15:09

pauloya