Angular 5 + AspNetCore + SpaServices + cshtml Can this be done?
This is a two part question...
1) About Angular 5/6 capabilities with Angular Universal and Server Side Rendering.
2) About Microsoft.AspNetCore.SpaServices and its' support for cshtml pages/injecting pre-rendered razor views into Angular.
The Goal
Merge both Angular and Asp.Net Core into one project (Not only for API use but also for server-side HTML rendering)
NOT use the existing Microsoft.AspNetCore.SpaTemplates Angular starter template, since it adds some extra complexity I don't need.
Utilize the strengths of Asp.Net Core Razor for partial view rendering & manipulation, then send the rendered HTML back to the Angular client
Angular Client should be able to inject the rendered HTML from the server, then continue DOM manipulation, Binding etc.
My Progress
I've successfully created a basic Asp.Net Core project then manually integrated Angular.
The steps are:
Create Asp.Net core project, then use the angular-cli to create a new project in the same directory " ng new MyAngularApp --minimal "
Manually copy the all the files from the "src" folder from the generated MyAngularApp into an Asp.Net Core new folder "ClientApp"
Then copy the json config files (angular-cli, package & tsconfig) into the root of your Asp.Net Project.
Best Reference I found how to do this was a Pluralsight Tutorial " Building a Web App with ASP.NET Core, MVC, Entity Framework Core, Bootstrap, and Angular" by Shawn Wildermuth - https://app.pluralsight.com/library/courses/aspnetcore-mvc-efcore-bootstrap-angular-web/table-of-contents (Check out the chapter on Client-side Development with Angular) - for the record I have no affiliation with Pluralsight or Shawn
The Problem/Question
I understand using Node.js as a back-end with Angular Universal, but I think in the Asp.Net Core world, there is a perfectly valid case for rendering html via Razor Page.
Here's an example of the Angular Component
链接地址: http://www.djcxy.com/p/52544.html