Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Using @addTagHelper in ASP.NET Core WebAPI. ASP.NET Prerendering@addTagHelper "*, Microsoft.AspNetCore.SpaServices"

$
0
0

I am developing "ASP.NET Core Web API" with "Angular 4". And this is my usual approach to use "Web API" template, so there are no folders such as"Views".

It was not a problem till I wanted to use Microsoft.AspNetCore.SpaServices. I am following this tutorial of Microsoft.AspNetCore.SpaServices Server Side Prerendering and there are two important steps to use power of Microsoft.AspNetCore.SpaServices:

1. go to your Views/_ViewImports.cshtml file, and add the following line: 

@addTagHelper "*, Microsoft.AspNetCore.SpaServices"

2. Choose a place in one of your MVC views where you want to prerender a SPA component. For example, openViews/Home/Index.cshtml, and add markup like the following:

<div id="my-spa" asp-prerender-module="ClientApp/boot-server"></div>


But "Web Api" does not have "Views" folder and I cannot do above steps?

So my questions are:

1. How is it possible to use "@addTagHelper" in "ASP.NET Core Web API"?
2. If it is not possible to use "@addTagHelper" in WebApi, is there any replacement for "@addTagHelper" in "ASP.NET Web API"?
3. What should I do instead of using "@addTagHelper"?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>