From 7f1223504f8a1ecd7668d665e8e7671cd7224d06 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 14 May 2019 14:30:46 +0200 Subject: [PATCH] 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 `
`) --- src/material/chips/chip-list.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/material/chips/chip-list.ts b/src/material/chips/chip-list.ts index 242ccb6cb58..96223ff6cb7 100644 --- a/src/material/chips/chip-list.ts +++ b/src/material/chips/chip-list.ts @@ -328,7 +328,11 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo @Output() readonly valueChange: EventEmitter = new EventEmitter(); /** The chip components contained within this chip list. */ - @ContentChildren(MatChip) chips: QueryList; + @ContentChildren(MatChip, { + // We need to use `descendants: true`, because Ivy will no longer match + // indirect descendants if it's left as false. + descendants: true + }) chips: QueryList; constructor(protected _elementRef: ElementRef, private _changeDetectorRef: ChangeDetectorRef,