Skip to content

Could not find 'BlazorExtensions' in 'window' (Server mode) #35

Description

@carlos-perez-rp

In a new project, using server side template, I added the reference to BlazorExtensions storage (0.2.1), added the services.AddStorage() line to register the services. If I modify the counter example to this:

`@page "/counter"
@using Blazor.Extensions.Storage
@Inject SessionStorage sessionStorage
@Inject LocalStorage localStorage

Counter

Current count: @currentCount

<button class="btn btn-primary" @OnClick="IncrementCount">Click me

@code {
int currentCount = 0;

async void IncrementCount()
{
    currentCount=await localStorage.GetItem<int>("counter");
    currentCount++;
    localStorage.SetItem("counter", currentCount).Wait();
}

}
`
I receive the error Could not find 'BlazorExtensions' in 'window'.
blazor.server.js is present in Sources when I enter in dev mode in chrome.
dotnet --version outputs 3.0.100-preview7-012821.

Is that correct?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions