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>`)
This commit is contained in:
Paul Gschwendtner
2019-05-14 14:30:46 +02:00
committed by Jeremy Elbourn
parent 58fc42969e
commit 7f1223504f
+5 -1
View File
@@ -328,7 +328,11 @@ export class MatChipList extends _MatChipListMixinBase implements MatFormFieldCo
@Output() readonly valueChange: EventEmitter<any> = new EventEmitter<any>();
/** The chip components contained within this chip list. */
@ContentChildren(MatChip) chips: QueryList<MatChip>;
@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<MatChip>;
constructor(protected _elementRef: ElementRef<HTMLElement>,
private _changeDetectorRef: ChangeDetectorRef,