Sijith
Sijith

Reputation: 31

Can I reset ion-content height on button click?

Can I reset ion-content scroll height on button click? I need to switch footer on button click, but the content height remains same

Upvotes: 0

Views: 1385

Answers (1)

sebaferreras
sebaferreras

Reputation: 44669

Just like you can see in the Content docs:

resize()

Tell the content to recalculate its dimensions. This should be called after dynamically adding/removing headers, footers, or tabs.

import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';

@Component({...})
export class MyPage{
  @ViewChild(Content) content: Content;
  public showFooter: boolean = true;

  hideFooter() {
    this.showFooter = false;
    this.content.resize(); // Tell the content to recalculate its dimensions
  }

  showFooter() {
    this.showFooter = true;
    this.content.resize(); // Tell the content to recalculate its dimensions
  }
}

Upvotes: 1

Related Questions