Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

There is no registered service of type 'Blazorise.Localization.ITextLocalizerService'

$
0
0

My script is trying to display images within Blazorise Carousel component. No error during compilation, no error on image path, but when loading the page, i get this error below. I search around online, but cannot find anything related this this error.

Error message: "InvalidOperationException: Cannot provide a value for property 'LocalizerService' on type 'Blazorise.Carousel'. There is no registered service of type 'Blazorise.Localization.ITextLocalizerService'."

Error is happening to this section below.

<Carousel Interval="5000">            @foreach (var imagePath in imagePaths)            {<CarouselSlide><img src="@($"images/{imagePath}")" class="d-block w-100" alt="Slide"></CarouselSlide>            }</Carousel>

Full code below.

<!-- Index.razor -->@page "/"@using System.IO@using Blazorise@using Blazorise.Localization<h1>Image List</h1>@if (imagePaths != null && imagePaths.Any()){<div class="image-list">        @* @foreach (var imagePath in imagePaths)        {<img src="@GetRelativePath(imagePath)" alt="Image">        } *@<Carousel Interval="5000">            @foreach (var imagePath in imagePaths)            {<CarouselSlide><img src="@($"images/{imagePath}")" class="d-block w-100" alt="Slide"></CarouselSlide>            }</Carousel></div>}else{<p>No images found.</p>}@code {    private List<string> imagePaths;    protected override void OnInitialized()    {        var folderPath = "wwwroot/images"; // Path to your images folder        imagePaths = Directory.GetFiles(folderPath, "*.jpg")                               .Concat(Directory.GetFiles(folderPath, "*.png"))                               .ToList();    }    private string GetRelativePath(string absolutePath)    {        return absolutePath.Replace("wwwroot", string.Empty);    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>