Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49351

[ngStyle] brief flash of unchanged font size

$
0
0

@joseph7 wrote:

Hey guys,

item-detail.html:

<h1 id="item_title"  *ngIf="hasProperty('name')" [ngStyle]="{'font-size': font_size}" innerHTML="{{item.name}}"></h1>

item-detail.ts:

font_size: any;

async ionViewWillEnter() {
    await getFontSize(this.settings).then((result) => {
      this.font_size = result;
    });
  }

getFontSize function in app.module.ts

export function getFontSize(settings: Settings): Promise<any> {
  return new Promise((resolve, reject) => {
    settings.getValue('font_size').then((res) => {
      let fontSize = res + 'rem';
      resolve(fontSize);
    }).catch((err) => {
      reject(new Error('failed to retrieve font size'));
    })
  })
}

So the problem is: When I change the font size in my settings page, and re-enter the item-detail page then I have a brief flash of old font_size before it is actually correctly set to newly changed size.
Any ideas?
Thanks in advance for the help.
Kind regards,
Filip

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49351

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>