Using @addTagHelper in ASP.NET Core WebAPI #696

Closed
opened 2025-08-09 17:17:18 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @NiceStepUp on 6/1/2017

I am following this tutorial of "Microsoft.AspNetCore.SpaServices Server Side Prerendering" and there are two important steps to use power "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, open "Views/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. How can I do above steps in Web API?

*Originally created by @NiceStepUp on 6/1/2017* I am following this tutorial of "Microsoft.AspNetCore.SpaServices Server Side Prerendering" and there are two important steps to use power "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, open "Views/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. How can I do above steps in Web API?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#696
No description provided.