error when starting BlockUIService in ngOnInit
See original GitHub issueI’m currently trying to upgrade my application to Angular 9 and when starting the ng-block-ui service in an ngOnInit hook i get this error in my console:
ng-block-ui: TypeError: Cannot convert undefined or null to object
at Function.from (<anonymous>)
at BlockUIDirective.push../node_modules/ng-block-ui/__ivy_ngcc__/fesm5/ng-block-ui.js.BlockUIDirective.isComponentInTemplate (ng-block-ui.js:836)
at BlockUIDirective.push../node_modules/ng-block-ui/__ivy_ngcc__/fesm5/ng-block-ui.js.BlockUIDirective.ngOnInit (ng-block-ui.js:802)
at callHook (core.js:2614)
at callHooks (core.js:2584)
at executeInitAndCheckHooks (core.js:2537)
at selectIndexInternal (core.js:6141)
at Module.ɵɵadvance (core.js:6114)
at RootComponent_Template (root.component.html:54)
at executeTemplate (core.js:7495)
BlockUIModule.forRoot() declared at top level module. The BlockUIDirective is used in my RootComponent.
Config:
- Angular: 9.0.1
- ng-block-ui: 3.0.0-beta.4
My suggestion is that this code:
private isComponentInTemplate(element: any): boolean {
let { children } = element || [];
children = Array.from(children).reverse();
return children.some((el: any) => el.localName === 'block-ui');
}
can be changed to
private isComponentInTemplate(element: any): boolean {
let { children = [] } = element;
children = Array.from(children).reverse();
return children.some((el: any) => el.localName === 'block-ui');
}
I did not wanted to do a pull request for one line change.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Getting error when trying to subscribe to function in ngOnInit
In your component the expression vehicle.ContactInformation.name is not defined, because ContactInformation is undefined.
Read more >Developing An Angular 2 Application With TypeScript
After compiling and launching the application, you can login with a username ... blockUIService, false)); } private handleError(error: any, ...
Read more >ng-block-ui - npm
To start blocking your app, simply invoke the start method. This method also can take a custom message to display while blocking. Once...
Read more >居家網紅推薦指南- $.blockui is not a function的推薦與評價 ...
$.blockui is not a function 在error when starting BlockUIService in ... The text was updated successfully, ... cannot use the block ui in...
Read more >Angular Error: "No Provider for Module..." - Blog Post
The error "No Provider for Module" is a common mistake when first starting ... import { Component, OnInit, OnDestroy } from '@angular/core'; ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JulienOuvrard not sure if you saw my comment above,
3.0.0-beta.6
has been released (npm i ng-block-ui@next
)Fixed by #113