Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockUI directive not working in Angular 18 #275

Open
ShoulderMonkey opened this issue Aug 29, 2024 · 3 comments
Open

BlockUI directive not working in Angular 18 #275

ShoulderMonkey opened this issue Aug 29, 2024 · 3 comments

Comments

@ShoulderMonkey
Copy link

ShoulderMonkey commented Aug 29, 2024

I'm upgrading to angular 18 from angular 17 in one of my projects and i'm getting error where using

@BlockUI()blockUI!: NgBlockUI

gives error:

TypeError: Cannot read properties of undefined (reading 'start')

had to switch to using the BlockUIService instead and specifying name in selector like so:

`<block-ui [template]="foregroundSpinner" name="test" >

constructor(
private blockUI: BlockUIService
){

  }

this.blockUI.start('test')
`

@eheck-is
Copy link

eheck-is commented Sep 6, 2024

FWIW, I have the same problem in one Angular app, but not in another. I found that in the app where the problem occurs, the decorator assigns the BlockUI instance to the component's prototype but the component object has its own property with an "undefined" value.
In the app where everything works, the BlockUI instance is still set into the prototype but the component object itself doesn't have the property and is getting the prototype value.

@eheck-is
Copy link

eheck-is commented Sep 9, 2024

... and a possible workaround for that is to set "useDefineForClassFields" to false in typescript options for the time being

@carlosavila890
Copy link

Hi! Any update on this? I'm facing the same error with the directive in Angular 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants