Git Product home page Git Product logo

blazorinangulardemo's Introduction

BlazorInAngularDemo

A demo project for integrating Blazor components into an existing Angular app.

 

Motivation

Although Blazor is a great choice for creating web frontends, abolishing an existing Angular app and starting from scratch is often no option. This project demonstrates, how .NET 7+ Blazor components can be integrated in an existing Angular project, making it possible to migrate step by step.

Implementation details

Here are the basic steps how we implemented the demo based on the original Angular project:

  • [Commit] We cloned the Tour of Heroes Angular demo application into the /Angular directory. We compiled and ran the Angular app to make sure everything was working so far: npm install --legacy-peer-deps and npm start.
  • [Commit] We created a simple .NET 7 Blazor WebAssembly project in the /Blazor directory. For the beginning, just a runnable app with a simple counter component, displayed on a test page.
  • [Commit] We created a HeroEditor component in Blazor, including a parameter and an event callback. Our goal is to replace the inner part of Angular's HeroDetailComponent later.
  • [Commit] We exported the Blazor components as web components, by using the Microsoft.AspNetCore.Components.CustomElements package, registering the elements as custom elements and running dotnet publish.
  • [Commit] We imported the compiled Blazor web components into the Angular project (see commit diff for all required steps) and replaced the app component by our Blazor counter component for a quick test. npm start now successfully serves the Blazor component in an Angular context.
  • [Commit] We integrated the Blazor HeroEditor web component into the Angular project. Property binding [hero]="hero" is intuitive, but event binding requires an extra step to get the correct scope in the event handler.
  • ... Work in progress, we will continue with:
    • Provide a running demo using GitHub Actions and GitHub Pages
    • Talking to an Angular service from Blazor
    • Trying to debug the Blazor component when running in Angular

blazorinangulardemo's People

Contributors

xenoage avatar

Stargazers

Caleb Frederickson avatar Caio Henrique Figurski avatar Chris Hartley avatar Bertus Viljoen avatar Mattias Thander avatar Kamolov Amir avatar Marty avatar  avatar mik3c avatar C Bee avatar Peter Guntermann avatar Varunkumar Manohar avatar Maxime Prat avatar Caleb Wells avatar  avatar 鬼谷子 avatar Chihab HAJJI avatar  avatar Todd Slavinsky avatar  avatar Mel Lota avatar  avatar Cameron Johnston avatar  avatar Tim Schwallie avatar Aaron Meyers avatar Baishali Ghosh avatar  avatar Jason Tucker avatar Manuel Kugelmann avatar

Watchers

 avatar  avatar  avatar

blazorinangulardemo's Issues

How to debug blazor assembly integrated with angular

Its not an issue but an enhancement. We have the same requirement of integrating the blazor into angular and we did it somthing similar to you. But now we need to to debug blazor assembly integrated with angular and not sure how it can be acheived. Would like to add the steps required to debug as an enhancement to this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.