ng-block-ui
ng-block-ui copied to clipboard
BlockUI directive always undefined when included within a library (Angular 16)
Issue with ng-block-ui in Angular 16
Description
Using [email protected] in Angular 16 works as expected when included within an application project, but it fails in libraries.
We include ng-block-ui as follows:
@BlockUI('content-wrapper') blockBody: NgBlockUI;
<div *blockUI="'content-wrapper'" class="content-wrapper"></div>
The spinner displays properly when used within an application, but when the library is compiled in ES2022 and included in an application, it always appears as undefined, regardless of where or when it is checked (in ngOnInit, ngAfterViewInit, constructor, and even in asynchronous subscribe), long after the template rendering.
Environment
-
Angular CLI: 16.2.5
-
Node: 19.6.0 (Unsupported)
-
Package Manager: npm 9.5.0
-
Operating System: Win32 x64
-
Angular: 16.2.8
-
... animations, common, compiler, compiler-cli, core, forms
-
... language-service, platform-browser, platform-browser-dynamic
-
... router
Package Versions
- @angular-devkit/architect: 0.1602.5
- @angular-devkit/build-angular: 16.2.5
- @angular-devkit/core: 16.2.5
- @angular-devkit/schematics: 16.2.5
- @angular/cli: 16.2.5
- @schematics/angular: 16.2.5
- ng-packagr: 16.2.3
- rxjs: 6.5.4
- typescript: 4.9.5
- zone.js: 0.13.3
Steps to Reproduce
- Include
ng-block-uiin an Angular library project. - Use
@BlockUIdecorator and*blockUIdirective within library components. - Include the library in an Angular application.
- Observe that the spinner always appears as
undefined.
Expected Behavior
The ng-block-ui spinner should function correctly in both library and application projects when using the same code.
Additional Information
- Ensure that you are using compatible versions of Angular and
ng-block-ui. - Verify the configuration of the module using
ng-block-uiwithin the library. - Use a supported version of Node as recommended by Angular.
Please let me know if you need any additional information to help resolve this issue.