@@ -235,14 +235,31 @@ export class MatFormField extends _MatFormFieldMixinBase
235
235
* @deprecated
236
236
* @breaking -change 8.0.0
237
237
*/
238
- @ViewChild ( 'underline' ) underlineRef : ElementRef ;
239
-
240
- @ViewChild ( 'connectionContainer' ) _connectionContainerRef : ElementRef ;
241
- @ViewChild ( 'inputContainer' ) _inputContainerRef : ElementRef ;
242
- @ViewChild ( 'label' ) private _label : ElementRef ;
243
- @ContentChild ( MatFormFieldControl ) _control : MatFormFieldControl < any > ;
244
- @ContentChild ( MatPlaceholder ) _placeholderChild : MatPlaceholder ;
245
- @ContentChild ( MatLabel ) _labelChild : MatLabel ;
238
+ @ViewChild ( 'underline' , { static : false } ) underlineRef : ElementRef ;
239
+
240
+ @ViewChild ( 'connectionContainer' , { static : true } ) _connectionContainerRef : ElementRef ;
241
+ @ViewChild ( 'inputContainer' , { static : false } ) _inputContainerRef : ElementRef ;
242
+ @ViewChild ( 'label' , { static : false } ) private _label : ElementRef ;
243
+
244
+ @ContentChild ( MatFormFieldControl , { static : false } ) _controlNonStatic : MatFormFieldControl < any > ;
245
+ @ContentChild ( MatFormFieldControl , { static : true } ) _controlStatic : MatFormFieldControl < any > ;
246
+ get _control ( ) {
247
+ // TODO(crisbeto): we need this hacky workaround in order to support both Ivy
248
+ // and ViewEngine. We should clean this up once Ivy is the default renderer.
249
+ return this . _explicitFormFieldControl || this . _controlNonStatic || this . _controlStatic ;
250
+ }
251
+ set _control ( value ) {
252
+ this . _explicitFormFieldControl = value ;
253
+ }
254
+ private _explicitFormFieldControl : MatFormFieldControl < any > ;
255
+
256
+ @ContentChild ( MatLabel , { static : false } ) _labelChildNonStatic : MatLabel ;
257
+ @ContentChild ( MatLabel , { static : true } ) _labelChildStatic : MatLabel ;
258
+ get _labelChild ( ) {
259
+ return this . _labelChildNonStatic || this . _labelChildStatic ;
260
+ }
261
+
262
+ @ContentChild ( MatPlaceholder , { static : false } ) _placeholderChild : MatPlaceholder ;
246
263
@ContentChildren ( MatError ) _errorChildren : QueryList < MatError > ;
247
264
@ContentChildren ( MatHint ) _hintChildren : QueryList < MatHint > ;
248
265
@ContentChildren ( MatPrefix ) _prefixChildren : QueryList < MatPrefix > ;
0 commit comments