I am developing an "ASP.NET Core Web API" with "Angular 4" . And this is my usual approach to using the Web API template, so there are no folders like Views.
This is not a problem until I wanted to use Microsoft.AspNetCore.SpaServices. I follow this Microsoft.AspNetCore.SpaServices Server Side Prerendering tutorial and there are two important steps to using power Microsoft.AspNetCore.SpaServices:
go to your Views/_ViewImports.cshtmlfile and add the following line:
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
Choose a place in one of your MVC views where you want to pre-order a SPA component. For example, open Views/Home/Index.cshtmland add markup as shown below:
<div id="my-spa" asp-prerender-module="ClientApp/boot-server"></div>
But Web Api does not have a folder Views, and I can not do the above steps?
So my questions are:
- How can i use
@addTagHelperin ASP.NET Core Web API? - If it is impossible to use
@addTagHelperin WebApi, is there a replacement for @addTagHelperin ASP.NET Web API? - What should I do instead of using
@addTagHelper?
source
share