question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ngOnChanges Hook not triggered in angular 9

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • [ x ] serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, it is working fine angular 7, but issue in angular 9.

Description

While dynamically changing the property, ngOnChanges hook not triggered in angular 9 but it properly triggered in angular 7.

Angular 7:

Please refer the below image, here we have used button name hidden click to changes the property.

image

In angular 7 the ngOnChanges hook are triggered properly from angular core level and I am getting changes from the changes parameter.

image

image

Angular 9:

Same as angular 9, ngOnChanges hook not triggered, at the time of property changes,

image

image

🔬 Minimal Reproduction

Angular 7 sample: https://github.com/kumaresan-subramani/Angular_diagram_7 Angular 9 sample: https://github.com/kumaresan-subramani/Angular_diagram_9

Steps to reproduce issue

  • npm i
  • ng serve

Then click button hidden to change the property, then you can reproduce the issue.

🔥 Exception or Error

No

🌍 Your Environment


Angular CLI: 7.3.10
Node: 10.15.1
OS: win32 x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.10
@angular-devkit/build-angular     0.13.10
@angular-devkit/build-optimizer   0.13.10
@angular-devkit/build-webpack     0.13.10
@angular-devkit/core              7.3.10
@angular-devkit/schematics        7.3.10
@angular/cli                      7.3.10
@ngtools/webpack                  7.3.10
@schematics/angular               7.3.10
@schematics/update                0.13.10
rxjs                              6.3.3
typescript                        3.2.4
webpack                           4.29.0


Angular CLI: 9.1.11
Node: 10.15.1
OS: win32 x64

Angular: 9.1.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.11
@angular-devkit/build-angular     0.901.11
@angular-devkit/build-optimizer   0.901.11
@angular-devkit/build-webpack     0.901.11
@angular-devkit/core              9.1.11
@angular-devkit/schematics        9.1.11
@angular/cli                      9.1.11
@ngtools/webpack                  9.1.11
@schematics/angular               9.1.11
@schematics/update                0.901.11
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Oct 14, 2020

Transferring to the framework repo for a better triage.

0reactions
angular-automatic-lock-bot[bot]commented, Nov 19, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngOnChanges not firing for nested object - Stack Overflow
Implement ngDoCheck() and perform your own change detection logic to determine if the array contents have changed. (The Lifecycle Hooks doc has an...
Read more >
Detecting @​Input changes in Angular with ngOnChanges ...
In this post you'll learn how to detect changes to an @Input property in Angular. We'll explore both using ngOnChanges lifecycle hook and ......
Read more >
OnChanges - Angular
A lifecycle hook that is called when any data-bound property of a directive changes. Define an ngOnChanges() method to handle the changes.
Read more >
ngOnChanges Example | Angular - StackChief
Use ngOnChanges whenever you want to detect changes from a variable decorated by @Input. Remember that only changes from the parent component ...
Read more >
Angular Lifecycle Hooks: ngOnChanges, ngOnInit, and more
ngOnChanges triggers following the modification of @Input bound class members. Data bound by the @Input() decorator come from an external source ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found