Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal Service Not Working #989

Open
ncveggm opened this issue Dec 29, 2024 · 0 comments
Open

Modal Service Not Working #989

ncveggm opened this issue Dec 29, 2024 · 0 comments

Comments

@ncveggm
Copy link

ncveggm commented Dec 29, 2024

I try to use Modal Service and follow the instructions in documentation but the modal not shown
this Home.razor
@page "/"
@using BlazorBootstrap
Home

Hello, world!

Welcome to your new app.

<Button Color="ButtonColor.Dark" @OnClick="() => ShowModal(ModalType.Dark)">Show Dark Modal

@code {
[Inject] ModalService ModalService { get; set; } = default!;
private async Task ShowModal(ModalType modalType)
{
var modalOption = new ModalOption
{
Title = "Modal title",
Message = "Modal body text goes here.",
Type = modalType,
};

    await ModalService.ShowAsync(modalOption);
}

}

I register service in program.cs

builder.Services.AddBlazorBootstrap();

add the links of css and js files in app.razor

<script src="_content/Blazor.Bootstrap/blazor.bootstrap.js"></script>

in MainLayout.razor I add
in the last of page

but the code not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant