Skip to content

Commit 7f12235

Browse files
devversionjelbourn
authored andcommitted
fix(chips): chip-list doesn't pick up wrapped chips with ivy
With Ivy, content queries no longer match nodes which aren't direct children of the given component. This breaks the chips as developers are currently able to have chips wrapped by other elements (e.g. a `<div>`)
1 parent 58fc429 commit 7f12235

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/material/chips/chip-list.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,11 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
328328
@Output() readonly valueChange: EventEmitter<any> = new EventEmitter<any>();
329329

330330
/** The chip components contained within this chip list. */
331-
@ContentChildren(MatChip) chips: QueryList<MatChip>;
331+
@ContentChildren(MatChip, {
332+
// We need to use `descendants: true`, because Ivy will no longer match
333+
// indirect descendants if it's left as false.
334+
descendants: true
335+
}) chips: QueryList<MatChip>;
332336

333337
constructor(protected _elementRef: ElementRef<HTMLElement>,
334338
private _changeDetectorRef: ChangeDetectorRef,

0 commit comments

Comments
 (0)