Skip to content

QueryList changes event not triggered by changes in children. #9689

@filipesilva

Description

@filipesilva

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Subscription to changes of a QueryList is not triggered by changes in the children of an HTML element.

Expected/desired behavior
Previously (although I cannot tell when this changed), the event was triggered.
Not sure if this is intended or not, @naomiblack @mhevery?

Reproduction of the problem
Documentation showing the expected (previous) behaviour can be found in https://angular.io/docs/ts/latest/guide/template-syntax.html#!#ngfortrackby . There is a live example link at the top that will create a plunker.

Lines 450-452 of app/app.component.html contain the template code, while lines 191-223 of app/app.component.ts contain the change detection code.

The relevant code is as follows:

<div #noTrackBy class="box">
  <div *ngFor="let hero of heroes">({{hero.id}}) {{hero.fullName}}</div>
</div>
@ViewChildren('noTrackBy') childrenNoTrackBy: QueryList<ElementRef>;
//...
this.childrenNoTrackBy.changes.subscribe((changes: any) => {
  // never triggered
}

Please tell us about your environment:

  • Angular version: 2.0.0-rc.3
  • Browser: [all ]
  • Language: [TypeScript X.X ]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions