Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't inject 'SweetAlertService' on Razor Component

HPnavalhas opened this issue · comments

Followed the Instalation/Usage Guide:

  • Installed the package via NuGet Package Manager
  • Added the service to Startup.cs
  • Added the script to _Host.cshtml

When trying to inject the dependecy I get:

image

This could be clarified in the README. You need a using directive for the file, just like any C# code referencing a library.

So above you @inject line add this

@using CurrieTechnologies.Razor.SweetAlert2

You can also add it to you _Imports.razor file to import it globally and not need it in your individual files.