victos / ng-busy

MIT License
17 stars 5 forks source link

issues adding ng-busy to Angular 5.2.1 #1

Closed JoeOwner closed 6 years ago

JoeOwner commented 6 years ago

Hi all, I'm currently adding ng-busy to my angular 5.2.1 application using WebPack with AOT. I've hit a few issues using the guide from npm (https://www.npmjs.com/package/ng-busy) and just thought I'd post them here for anyone who might be experiencing the same troubles, and maybe a fix/documentation update in the future (assuming its not something that is specific to my setup which it very well could be).

1) <-- Simple syntax does not work. --> <div [ngBusy]="busy">

BUT <-- Advanced syntax does work --><div [ngBusy]="{busy: busy}">

2) In the root application module: "NgBusyModule.forRoot({})" results in "Property 'forRoot' does not exist on type 'typeof ngBusyModule'

3) trying to use a component in the Application module, the component must be added to the list of entryComponents: declarations: [ ... BrowserAnimationsModule, NgBusyModule, CustomBusyComponent, ...
], entryComponents: [ ... CustomBusyComponent, ... ], imports: [ ... ],

4) I'm also getting a non-breaking error that I've been unable to resolve. When adding message as in the documentation: "ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'null: undefined'. Current value: 'null: Loading...'. It seems like the view has been created after its parent and its children have been dirty checked. Has it been created in a change detection hook ?"

Thanks

victos commented 6 years ago

Hello @JoeOwner , I've update the readme about 1 and 3. And I added the forRoot function on ngBusyModule. Regarding the error in 4, you can just ignore it since it only appears in dev environment. The error message had been removed from the default template , if you want to remove the error from your custom template , maybe you can look at here the online demo has the code that remove the error message (ChangeDetectorRef part). Thanks for your report.

JoeOwner commented 6 years ago

@victos Thanks so much for the quick response. That all sounds easy enough to take care of. Keep up the good work.