@inject IStorageService StorageService @inject IPermissionService PermissionService @inject IGlossaryDialogService GlossaryDialogService @inject IJSRuntime JsRuntime @if (isLoaded) { } Not found Sorry, there's nothing at this address. @code { private bool isLoaded; protected override async Task OnInitializedAsync() { await StorageService.Load(); isLoaded = true; StateHasChanged(); } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await JsRuntime.InvokeVoidAsync("eval", @" window.glossaryInterop = { dotNetRef: null, init: function(dotNetRef) { this.dotNetRef = dotNetRef; document.addEventListener('click', function(e) { var target = e.target; while (target) { if (target.classList && target.classList.contains('glossary-link')) { var id = target.getAttribute('data-glossary-id'); if (id && window.glossaryInterop.dotNetRef) { window.glossaryInterop.dotNetRef.invokeMethodAsync('OpenGlossaryTerm', id); e.preventDefault(); return; } } target = target.parentElement; } }); } }; "); await JsRuntime.InvokeVoidAsync("glossaryInterop.init", DotNetObjectReference.Create(this)); } } [JSInvokable] public void OpenGlossaryTerm(string termId) { GlossaryDialogService.AddDialog(termId); StateHasChanged(); } }
Sorry, there's nothing at this address.