I use code example MatTable and appears this error:
InvalidOperationException: Cannot provide a value for property 'Http' on type 'MatBlazor.MatTable`1[[Rtu_UI.Pages.Index+Todo, Rtu_UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'. There is no registered service of type 'System.Net.Http.HttpClient'.
You need to add service for HttpClient in startup.cs page
I have the same error. I don't use an api call, so why should i add the HttpClient?
Edit:
I tried to add the HttpClient in startup.cs, but i still get that error
I have the same error. I don't use an api call, so why should i add the HttpClient?
Edit:
I tried to add the HttpClient in startup.cs, but i still get that error
I also ran into this problem, and the solution was to register the HttpClient service in the Startup class's ConfigureServices method
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<HttpClient>();
}
}
However, I don't know why I need to register HttpClient when I'm not using an API call
MatTable will be replaced with MatDataTable in the near future. If you are still concerned about this issue and it still exists please create a BlazorFiddle to recreate. Thanks
It's easy to reproduce: Simply don't add a HttpClient in Startup, and the MatTable won't render but instead throw, as the @inject System.Net.Http.HttpClient Http directive can't be fulfilled anymore.
A Table component definitely should not require a dependency on a HttpClient to function.
MatTable will be replaced with MatDataTable in the near future. If you are still concerned about this issue and it still exists please create a BlazorFiddle to recreate. Thanks
Any news on this progress around matdatatable?
Im looking at both the general virtualize enhancements and some missing outlined class props in current mattable.
Most helpful comment
I also ran into this problem, and the solution was to register the HttpClient service in the Startup class's ConfigureServices method
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddScoped<HttpClient>(); } }However, I don't know why I need to register HttpClient when I'm not using an API call