Example of using asp-prerender-data to get server-supplied data to both server and client JS

This commit is contained in:
Steve Sanderson
2017-05-22 10:25:08 +01:00
parent ad645cbfe9
commit 678e230021
5 changed files with 17 additions and 5 deletions

View File

@@ -2,7 +2,11 @@
ViewData["Title"] = "Home Page";
}
<app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
<app asp-prerender-module="ClientApp/dist/main-server"
asp-prerender-data="new {
IsGoldUser = true,
Cookies = ViewContext.HttpContext.Request.Cookies
}">Loading...</app>
<script src="~/dist/vendor.js" asp-append-version="true"></script>
@section scripts {