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

Ivy: regression when opening a datepicker #3150

Closed
jnizet opened this issue Apr 27, 2019 · 0 comments · Fixed by #3152
Closed

Ivy: regression when opening a datepicker #3150

jnizet opened this issue Apr 27, 2019 · 0 comments · Fixed by #3152

Comments

@jnizet
Copy link
Member

jnizet commented Apr 27, 2019

Bug description:

With Ivy, opening a datepicker causes an error to be displayed in the console:

On Chrome:

ERROR TypeError: Cannot read property 'nativeElement' of undefined
    at ng-bootstrap.js:4162
    at ZoneDelegate.invoke (zone-evergreen.js:359)
    at Zone.run (zone-evergreen.js:124)
    at NgZone.runOutsideAngular (core.js:30819)
    at NgbDatepicker.ngAfterContentInit (ng-bootstrap.js:4160)
    at callHook (core.js:4842)
    at callHooks (core.js:4806)
    at executeHooks (core.js:4757)
    at refreshDescendantViews (core.js:11598)
    at renderComponentOrTemplate (core.js:11976)

On Firefox:

ERROR TypeError: "this._monthsEl is undefined"
    ngAfterContentInit ng-bootstrap.js:4162
    Angular 3
    ngAfterContentInit ng-bootstrap.js:4160
    Angular 8
    open ng-bootstrap.js:5278
    toggle ng-bootstrap.js:5310
    StatsComponent_Template_button_click_6_listener StatsComponent.js:29

Link to minimally-working StackBlitz that reproduces the issue:

No Stackblitz because it's an Ivy issue, but the bug can easily be reproduced by cloning the following repo and following the instructions in the README (bug 2): https://github.com/jnizet/valuechangesivy

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 8.0.0-rc.1

ng-bootstrap: 4.1.1

Bootstrap: 4.0.0

jnizet added a commit to jnizet/ng-bootstrap that referenced this issue Apr 27, 2019
datepicker accessed a view child from the ngAfterContentInit hook instead of accessing it from the ngAfterViewInit hook.
This doesn't work anymore with Ivy. That is a regression in Ivy, but is also an issue with ng-bootstrap which doesn't respect the standard life-cycle.
Besides, the component didn't implement the AfterContentInit interface.
It now implements the AfterViewInit interface.

fix ng-bootstrap#3150
@maxokorokov maxokorokov added this to the 4.1.2 milestone Apr 30, 2019
maxokorokov pushed a commit that referenced this issue Apr 30, 2019
Datepicker accessed a view child from the `ngAfterContentInit` hook instead of accessing it from the `ngAfterViewInit` hook.

This doesn't work anymore with Ivy. That is a regression in Ivy, but is also an issue with ng-bootstrap which doesn't respect the standard life-cycle.
Besides, the component didn't implement the `AfterContentInit` interface.
It now implements the `AfterViewInit` interface.

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

Successfully merging a pull request may close this issue.

2 participants