Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup for WebAssembly

ryanbuening opened this issue · comments

Describe the bug
I tried following the documentation for setup with Blazor using WebAssembly but I'm unable to successfully get it working.

To Reproduce
Steps to reproduce the behavior: (tried to follow readme documentation)

  1. Install CurrieTechnologies.Razor.SweetAlert2 version 3.0.0
  2. Add builder.Services.AddSweetAlert2(); to Main() in Program.cs
  3. Add <script src="_content/CurrieTechnologies.Razor.SweetAlert2/sweetAlert2.min.js"></script> to index.html
  4. Add @using CurrieTechnologies.Razor.SweetAlert2 to _Imports.razor
  5. Add @inject SweetAlertService Swal; to FooPage.razor
  6. Add <button class="btn btn-primary" @onclick="(async () => await Swal.FireAsync("Any fool can use a computer"))">Try me!</button> to FooPage.razor

Expected behavior
FooPage.razor compiles and runs

Actual behavior
FooPage.razor reports error: CS1026 ) expected

Additional context
Running Visual Studio 2019 16.8.0 Preview 3.1 with net5.0 (rc1)

You are missing @ before (
<button class="btn btn-primary" @onclick="@(async () => await Swal.FireAsync("Any fool can use a computer"))">Try me!</button>