stavroskasidis / BlazorContextMenu

A context menu component for Blazor !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'blazorContextMenu' was undefined

Gopichandar opened this issue · comments

I made a exact basic sample provided and I got this error on running in .Net 6. Any idea why?

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Could not find 'blazorContextMenu.SetMenuHandlerReference' ('blazorContextMenu' was undefined).
      Error: Could not find 'blazorContextMenu.SetMenuHandlerReference' ('blazorContextMenu' was undefined).
          at https://localhost:44355/_framework/blazor.webassembly.js:1:328
          at Array.forEach (<anonymous>)
          at a.findFunction (https://localhost:44355/_framework/blazor.webassembly.js:1:296)
          at _ (https://localhost:44355/_framework/blazor.webassembly.js:1:2437)
          at https://localhost:44355/_framework/blazor.webassembly.js:1:3325
          at new Promise (<anonymous>)
          at Object.beginInvokeJSFromDotNet (https://localhost:44355/_framework/blazor.webassembly.js:1:3306)
          at Object.Rt [as invokeJSFromDotNet] (https://localhost:44355/_framework/blazor.webassembly.js:1:59738)
          at _mono_wasm_invoke_js_blazor (https://localhost:44355/_framework/dotnet.6.0.1.1jrhn1vj7r.js:1:194546)
          at wasm://wasm/009705ea:wasm-function[219]:0x1a129
Microsoft.JSInterop.JSException: Could not find 'blazorContextMenu.SetMenuHandlerReference' ('blazorContextMenu' was undefined).
Error: Could not find 'blazorContextMenu.SetMenuHandlerReference' ('blazorContextMenu' was undefined).
    at https://localhost:44355/_framework/blazor.webassembly.js:1:328
    at Array.forEach (<anonymous>)
    at a.findFunction (https://localhost:44355/_framework/blazor.webassembly.js:1:296)
    at _ (https://localhost:44355/_framework/blazor.webassembly.js:1:2437)
    at https://localhost:44355/_framework/blazor.webassembly.js:1:3325
    at new Promise (<anonymous>)
    at Object.beginInvokeJSFromDotNet (https://localhost:44355/_framework/blazor.webassembly.js:1:3306)
    at Object.Rt [as invokeJSFromDotNet] (https://localhost:44355/_framework/blazor.webassembly.js:1:59738)
    at _mono_wasm_invoke_js_blazor (https://localhost:44355/_framework/dotnet.6.0.1.1jrhn1vj7r.js:1:194546)
    at wasm://wasm/009705ea:wasm-function[219]:0x1a129
   at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
   at BlazorContextMenu.ContextMenuBase.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Did you load the js file ?
Is it being loaded correctly ?

image

Yes. That's the issue. Js file is not loaded properly. Thanks @stavroskasidis