BlazorInAngularDemo icon indicating copy to clipboard operation
BlazorInAngularDemo copied to clipboard

Doesnt work if you refresh the page that hosts the blazor component

Open ZeroZeroOne-dev opened this issue 10 months ago • 0 comments

I'm playing with blazor in angular myself and I decided to check out your example. And it seems it suffers from the same limitations as i encounter in my own attempts.

If you go to the edit hero page that hosts the edit hero blazor component and refresh the page, the component functionality breaks. I think it has something to do with the fact that it takes blazor a few seconds to start up, and the attribute and event listener are set too fast.

It also breaks if you have a blazor component on the opening page of the angular application.

In my own example if i set a timeout of 1 second around the binding of the attribute and event listener it fixes the issue.

ngAfterViewInit(): void {
    setTimeout(() => {
      this.display.nativeElement.hero = this.hero;
      this.display.nativeElement.heroChanged= this.onHeroChanged.bind(this);
    }, 1000);
  }

If someone knows a proper fix for this issue please lmk.

ZeroZeroOne-dev avatar Jun 07 '25 14:06 ZeroZeroOne-dev