Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$onChanges hook is not working as expected in angular 1.5.4 #14433

Closed
@bogdanalexe90

Description

@bogdanalexe90

Note: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?

  1. $onChanges is not called every time.
  2. $onChanges is called before $onInit.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
I'm having a component with a binding defined like this:

{
   obj: '<' @Object
}

1.The $onChanges is called before $onInit hook.

  1. The $onChanges is called when the components inits, it's called for the first change and than is not called for the rest of the changes.
    The property that changes is an object but the changes itself is done on the object reference not on the one of the properties. This works with angular 1.5.3.

What is the expected behavior?

  1. The $onChanges hook should be called every time when there's a change on a one-way binding property.
  2. $onChanges should be called after $onInit

What is the motivation / use case for changing the behavior?
Not compatible with applications that worked on 1.5.3

Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
1.5.4 / Mac OS X 10.11.4

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions