2

The HTML design that I'm using in my WASM application uses feathericons, I linked the css and the js files in wwwroot/index.html. When I want to use the icons, for example:

<i data-feather="grid"></i>

if I use it inside wwwroot/index.html the icon appears, but if I use it in shared component MainLayout.razor the icon doesn't appear.

How can I solve this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
Abdulsalam Elsharif
  • 4,773
  • 7
  • 32
  • 66

1 Answers1

1

I have been battling with this myself in my own Blazor app. I suspect that it may be attempting to run the feather.replace() before the page is loaded.

My solution for now has been to add in a timeout as I saw used in another post.

At the end of your body in index.html add:

<script>
    setTimeout(function () {
        feather.replace();
    }, 3000)
</script>

If I have issues with this or something changes as I'm developing my site then I'll update this post with details.

Milan Š.
  • 1,353
  • 1
  • 2
  • 11
Vargur
  • 11
  • 3