Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Accessing property values when using ASP.NET Core Blazor JavaScript with static SSR

$
0
0

Regarding this doc from Microsoft - https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/static-server-rendering?view=aspnetcore-9.0

Does anyone know how to either pass data to, or access property values from the related razor file in these enhanced navigation js functions:

export function onLoad() {  console.log('Loaded');}export function onUpdate() {  console.log('Updated');}export function onDispose() {  console.log('Disposed');}

e.g. In the same docs there's this example razor file:

@page "/page-with-script"@using BlazorPageScript<PageTitle>Enhanced Load Script Example</PageTitle><PageScript Src="./Components/Pages/PageWithScript.razor.js" />Welcome to my page.

Suppose it also had this:

@code {    public string SomeProp { get; set; } = "Hello, World!;}

How could I pass "SomeProp" to the onUpdate() function? Although this function is triggered by an "enhancedload" so probably can't pass to it, but can I access the razor property from the function somehow?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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