Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@inject IUriHelper in Client side isn't working in Blazor 0.8 #1787

Closed
RobertoRodrigues opened this Issue Feb 13, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@RobertoRodrigues
Copy link

RobertoRodrigues commented Feb 13, 2019

I create a project Blazor (ASP.NET Core hosted) and inject IUriHelper in index.cshtml but is not accessible.

I try

@page "/"
@inject Microsoft.AspNetCore.Blazor.Services.IUriHelper UriHelper

and

@page "/"
@inject IUriHelper UriHelper
@kswoll

This comment has been minimized.

Copy link

kswoll commented Feb 13, 2019

Are you getting a compiler error? Or is it null?

@RobertoRodrigues

This comment has been minimized.

Copy link
Author

RobertoRodrigues commented Feb 13, 2019

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0246	The type or namespace name 'IUriHelper' could not be found (are you missing a using directive or an assembly reference?)	WebApplication1.Client	C:\dev\WebApplication1\WebApplication1.Client\Pages\Index.cshtml	1	Active
Error	CS0246	The type or namespace name 'IUriHelper' could not be found (are you missing a using directive or an assembly reference?)	WebApplication1.Client	C:\dev\WebApplication1\WebApplication1.Client\Pages\Index.cshtml	1	Active
Error	CS0246	The type or namespace name 'IUriHelper' could not be found (are you missing a using directive or an assembly reference?)	WebApplication1.Client	C:\dev\WebApplication1\WebApplication1.Client\Pages\Index.cshtml	2	Active

```
is a new application with only the line @inject IUriHelper UriHelper
@chucker

This comment has been minimized.

Copy link

chucker commented Feb 13, 2019

The namespace has changed:

@inject Microsoft.AspNetCore.Components.Services.IUriHelper UriHelper
@RobertoRodrigues

This comment has been minimized.

Copy link
Author

RobertoRodrigues commented Feb 13, 2019

it's works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.