Mohammad
Mohammad

Reputation: 75

How to use Blazor WASM gradually as part of existing Asp.Net Core Angular project

I have an application with Asp.Net core back-end and Angular front-end I want to convert the front-end part of it to Blazor WASM because it is very big I need to convert the frontend part of it gradually now my question is,Is there any way to use Blazor WASM component in Asp.Net Angular project or even further is there any way to use Blazor component inside an Angular component?

Upvotes: 2

Views: 793

Answers (1)

Andi
Andi

Reputation: 3498

The trick is to make the Blazor component(s) available for instantiation from JavaScript by calling JSComponentConfigurationExtensions.RegisterForJavaScript, which is available from ASP.NET Core 6.0 on.

Bridging the gap from a Blazor component to an Angular component requires some further steps. The JavaScript Component Generation sample from the ASP.NET samples shows one possible solution.

Based on this code, I've created a demo project BlazorInAngularDemo including an automated build process (see demo deployed to github pages).

Upvotes: 1

Related Questions