From 1d40ec97490f19fd938c34591b846e7c70280cf4 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 18 Oct 2019 18:30:31 +0200 Subject: [PATCH] fix(form-field): ensure that descendants are picked up in Ivy (#17439) Since there's a slight difference in how `ContentChildren` works in Ivy, these changes add the `descendants` flag explicitly to ensure that we pick up all of the relevant elements. Note that we shouldn't need any extra logic, because nesting form fields is invalid. --- src/material/form-field/form-field.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/material/form-field/form-field.ts b/src/material/form-field/form-field.ts index 6cdb0432570e..8bf83c8d8a7c 100644 --- a/src/material/form-field/form-field.ts +++ b/src/material/form-field/form-field.ts @@ -270,10 +270,10 @@ export class MatFormField extends _MatFormFieldMixinBase } @ContentChild(MatPlaceholder, {static: false}) _placeholderChild: MatPlaceholder; - @ContentChildren(MatError) _errorChildren: QueryList; - @ContentChildren(MatHint) _hintChildren: QueryList; - @ContentChildren(MatPrefix) _prefixChildren: QueryList; - @ContentChildren(MatSuffix) _suffixChildren: QueryList; + @ContentChildren(MatError, {descendants: true}) _errorChildren: QueryList; + @ContentChildren(MatHint, {descendants: true}) _hintChildren: QueryList; + @ContentChildren(MatPrefix, {descendants: true}) _prefixChildren: QueryList; + @ContentChildren(MatSuffix, {descendants: true}) _suffixChildren: QueryList; constructor( public _elementRef: ElementRef, private _changeDetectorRef: ChangeDetectorRef,