vikramlearning / blazorbootstrap-starter-templates

Blazor Bootstrap - Starter Templates (.NET 6/7/8)
https://docs.blazorbootstrap.com
24 stars 16 forks source link

Could not find window.blazorBootsrap.collapse.initialize ('blazorBootsrap' was undefined) #9

Open alexnayberg opened 6 months ago

alexnayberg commented 6 months ago

Hello, I just installed BlazorBootstrap on a Blazor Web App project on .Net 8. I am having a problem with a component that's using Accordion. This is the error I am seeing:

Error: Microsoft.JSInterop.JSException: Could not find 'window.blazorBootstrap.collapse.initialize' ('blazorBootstrap' was undefined). Error: Could not find 'window.blazorBootstrap.collapse.initialize' ('blazorBootstrap' was undefined). at https://localhost:7281/_framework/blazor.web.js:1:734 at Array.forEach () at l.findFunction (https://localhost:7281/_framework/blazor.web.js:1:702) at b (https://localhost:7281/_framework/blazor.web.js:1:5445) at https://localhost:7281/_framework/blazor.web.js:1:3238 at new Promise () at y.beginInvokeJSFromDotNet (https://localhost:7281/_framework/blazor.web.js:1:3201) at fn._invokeClientMethod (https://localhost:7281/_framework/blazor.web.js:1:62541) at fn._processIncomingData (https://localhost:7281/_framework/blazor.web.js:1:60016) at connection.onreceive (https://localhost:7281/_framework/blazor.web.js:1:53657) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args) at BlazorBootstrap.Collapse.b__4_0() at BlazorBootstrap.BlazorBootstrapComponentBase.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

I tried it in both Server and WebAssembly projects, and got the error in both. I followed your instructions to make sure I didn't miss anything: Getting Started.

gvreddy04 commented 6 months ago

@alexnayberg, thank you for trying BlazorBootstrap. Please share a sample code or GitHub repo to reproduce the issue, rather than assuming. This will help us to better understand the issue.

gvreddy04 commented 6 months ago

@alexnayberg Please test your changes in the below starter project and let me know.

Starter Project: https://github.com/vikramlearning/blazorbootstrap-starter-templates/tree/master/src/BlazorBootstrap.Templates.Starter/Net8.BlazorAutoGlobal

alexnayberg commented 6 months ago

Thank you for responding! I just took your boilerplate code from your demo website and ran it locally: `@page "/test-client" @rendermode InteractiveWebAssembly

Accordion Item #1 This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. Accordion Item #2 This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. Accordion Item #3 This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. ` And I did it on both client (above) and server projects: `@page "/test-server" @rendermode InteractiveServer Accordion Item #1 This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. Accordion Item #2 This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. Accordion Item #3 This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. ` I also upgraded the nuger package to the latest version. Same behaviour before and after the upgrade though. I really like your framework, I've used it on .MET6 and .NET7 projects and it's been working great. I just want to keep using it with .NET8 so I can take advantages of all the new stuff Blazor has to offer. Thanks again for follow up.
gvreddy04 commented 6 months ago

@alexnayberg Pleaseshare the below information:

Also share a GitHub repo to reproduce your issue. I'll a take look and let you know what was missing.