title: ngOnChanges only hitting root of tree, not all offsprings
body: <p>My parent component has a non binary tree node(the root of the tree) as child.
  Every node can have 0 or multiple children of type node, and the children can be collapsed or expanded.
  Additionally, in my parent component, there is button that allows you to <strong>Collapse All</strong> or <strong>Expand All</strong> children of all nodes in the tree.</p>
  <p>I have an enum that marks whether the entire tree is collapsed(via button), the entire tree is expanded(via button), or if the tree status is controlled manually(which is not relevant for this issue).</p>
  <p>The enum looks like this:</p>
  <pre><code>export enum TreeStatus{
    Collapsed,
    Expanded,
    Manual
  }
  </code></pre>
  <p>parent.component.ts:</p>
  <pre><code>export class ParentComponent implements OnInit {
    root: Node;
    public treeStatus= TreeStatus.Collapsed;   //in the beginning, every node in the tree has children collapsed
    public isAnyNodeChildrenCollapsed = true;  //checks if any node has children collapsed(mainly used for manual toggle)
  
    onExpandAll() {
      this.treeStatus= TreeStatus.Expanded;
      this.isAnyNodeChildrenCollapsed = false;
    }
  
    onCollapseAll(){
      this.treeStatus= TreeStatus.Collapsed;
      this.isAnyNodeChildrenCollapsed = true;
    }
    
    ...
  }
  </code></pre>
  <p>parent.component.html:</p>
  <pre><code>&lt;div&gt;
    &lt;button *ngIf=&quot;!isAnyNodeChildrenCollapsed &quot; (click)=&quot;onCollapseAll()&quot;&gt;  //if all nodes have children expanded, we will see the button that allows us to collapse all
      Collapse All
    &lt;/button&gt;
    &lt;button *ngIf=&quot;isAnyNodeChildrenCollapsed &quot; (click)=&quot;onExpandAll()&quot;&gt;     //if at least one node has children collapsed, we will see the button that allows us to expand all
      Expand All
    &lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
    &lt;tree-item [node]=&quot;root&quot; [treeStatus]=&quot;treeStatus&quot;&gt;&lt;/tree-item&gt;            //the root of my tree
  &lt;/div&gt;
  </code></pre>
  <p>tree-item.component.ts:</p>
  <pre><code>export class TreeItemComponent implements OnInit, OnChanges{
     @Input() node: Node;
     @Input() treeStatus: TreeStatus;
     public isChildrenCollapsed = true;  //initially, all nodes have children collapsed
  
     ngOnChanges(changes: SimpleChanges) {
      console.log(this.node.id + &quot;: &quot; + changes.treeStatus.previousValue + &quot; =&gt; &quot; + changes.TreeStatus.currentValue);   
      //this log above best displays the issue. When I click on Expand All, all nodes in my tree appear in the logs, but when I click Collapse All, even though this is the same callback method, only the root appears to detect the change.(even so, the toggle somehow happens regardless)
  
      if (changes.treeStatus &amp;&amp; changes.treeStatus.currentValue!=NavigatorTreeStatus.Manual) {
        this.isChildrenCollapsed = !(changes.treeStatus.currentValue == NavigatorTreeStatus.Expanded);
        }
      }
    }
  
  }
  </code></pre>
  <p>tree-item.component.html(basic DFS tree parsing):</p>
  <pre><code>&lt;div&gt;
  //display node here
  &lt;/div&gt;
  &lt;div *ngIf=&quot;node.children.length &gt; 0 &amp;&amp; !isChildrenCollapsed&quot;&gt;
    &lt;tree-item *ngFor=&quot;let child of node.children&quot;
               [node]=&quot;child&quot; 
               [treeStatus]=&quot;treeStatus&quot; 
    &gt;
  &lt;/div&gt;
  </code></pre>
  <p>I simply cannot understand why, when I hit <strong>Expand All</strong>, thus changing treeStatus to Expanded, the ngOnChanged works properly and as expected, propagating to every node in the three, but when hitting <strong>Collapse All</strong> now, which triggers the same ngOnChanges callback method, the only node that detects the change seems to be the root.</p>
  <p><strong>Here is how the logs appear:</strong>
  Initially, when opening component, root id gets status 0(Collapsed), instead of undefined:</p>
  <blockquote>
  <p>2013777645: undefined =&gt; 0</p>
  </blockquote>
  <p>After you hit <strong>Expand All</strong>, root Id changes value from 0(Collapsed), to 1(Expanded), and the rest of the nodes change from undefined to 1(Expanded)</p>
  <blockquote>
  <p>2013777645: 0 =&gt; 1</p>
  <p>2118369458: undefined =&gt; 1</p>
  <p>368241412: undefined =&gt; 1</p>
  <p>1860836078: undefined =&gt; 1</p>
  <p>1979885541: undefined =&gt; 1</p>
  <p>1316570423: undefined =&gt; 1</p>
  <p>360484732: undefined =&gt; 1</p>
  <p>506271756: undefined =&gt; 1</p>
  </blockquote>
  <p>Now, after hitting <strong>Collapse All</strong>, only the root appears in the log, changing values from 1(Expanded) to 0(Collapsed).</p>
  <blockquote>
  <p>2013777645: 1 =&gt; 0</p>
  </blockquote>
  <p>Finally, if we hit again <strong>Expand All</strong> now, the exact same logs appear as before, even if the other nodes should not have an undefined value for treeStatus, as it has been assigned a value before.</p>
  <blockquote>
  <p>2013777645: 0 =&gt; 1</p>
  <p>2118369458: undefined =&gt; 1</p>
  <p>368241412: undefined =&gt; 1</p>
  <p>1860836078: undefined =&gt; 1</p>
  <p>1979885541: undefined =&gt; 1</p>
  <p>1316570423: undefined =&gt; 1</p>
  <p>360484732: undefined =&gt; 1</p>
  <p>506271756: undefined =&gt; 1</p>
  </blockquote>
  <p>Can you please help me understand what I am missing?
  I really hope you can understand the issue from this explanation.
  Thank you in advance!</p>