Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

blazor - Client MatBlazor matbutton could not find init (matblazor was undefined

I am trying to add MatBlazor to my WASM client and I am getting the error:

blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Could not find 'matBlazor.matButton.init' ('matBlazor' was undefined).
      Error: Could not find 'matBlazor.matButton.init' ('matBlazor' was undefined).
          at https://localhost:5001/_framework/blazor.webassembly.js:1:1287
          at Array.forEach (<anonymous>)
          at e.findFunction (https://localhost:5001/_framework/blazor.webassembly.js:1:1247)
          at b (https://localhost:5001/_framework/blazor.webassembly.js:1:2989)
          at https://localhost:5001/_framework/blazor.webassembly.js:1:3935
          at new Promise (<anonymous>)
          at Object.beginInvokeJSFromDotNet (https://localhost:5001/_framework/blazor.webassembly.js:1:3908)
          at Object.w [as invokeJSFromDotNet] (https://localhost:5001/_framework/blazor.webassembly.js:1:64218)
          at _mono_wasm_invoke_js_blazor (https://localhost:5001/_framework/dotnet.5.0.1.js:1:190800)
          at do_icall (<anonymous>:wasm-function[10596]:0x194e58)
Microsoft.JSInterop.JSException: Could not find 'matBlazor.matButton.init' ('matBlazor' was undefined).

It was working on .NET Core, but started throwing an error on .Net 5.0.

I must be missing a step or something.

Suggestions?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem turned out to be I forgot to include the MatBlazor links in index.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...