diff --git a/src/directives/format-text.ts b/src/directives/format-text.ts index b4bec6d50..ded8c96d9 100644 --- a/src/directives/format-text.ts +++ b/src/directives/format-text.ts @@ -272,6 +272,14 @@ export class CoreFormatTextDirective implements OnChanges { return; } + // In AOT the inputs and ng-reflect aren't in the DOM sometimes. Add them so styles are applied. + if (this.maxHeight && !this.element.getAttribute('maxHeight')) { + this.element.setAttribute('maxHeight', String(this.maxHeight)); + } + if (!this.element.getAttribute('singleLine')) { + this.element.setAttribute('singleLine', String(this.utils.isTrueOrOne(this.singleLine))); + } + this.text = this.text ? this.text.trim() : ''; this.formatContents().then((div: HTMLElement) => { @@ -281,11 +289,6 @@ export class CoreFormatTextDirective implements OnChanges { this.element.innerHTML = ''; // Remove current contents. if (this.maxHeight && div.innerHTML != '') { - // For some reason, in iOS the inputs and ng-reflect aren't in the DOM sometimes. Add it so styles are applied. - if (!this.element.getAttribute('maxHeight')) { - this.element.setAttribute('maxHeight', String(this.maxHeight)); - } - // Move the children to the current element to be able to calculate the height. this.domUtils.moveChildren(div, this.element);