ant-design-blazor/components/core/ServiceCollectionExtensions.cs
zxyao cd73cf1cdd feat: add component notification (#99)
* feat: add notification

* fix: onclick event trigger on onclise on server rendering

* fix: notification no longer requires container

* fix: convert OnClick and OnClose type to event
2020-05-10 22:43:58 +08:00

27 lines
851 B
C#

using System.Net.Http;
using System.Text.Encodings.Web;
using AntBlazor;
using AntBlazor.JsInterop;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.JSInterop;
namespace Microsoft.Extensions.DependencyInjection
{
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddAntBlazor(this IServiceCollection services)
{
services.TryAddSingleton<HttpClient>();
services.TryAddScoped<DomEventService>();
services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService<ILoggerFactory>(),
s => HtmlEncoder.Default.Encode(s)))
);
services.TryAddScoped<AntNotificationService>();
return services;
}
}
}