Ionic-framework: Unable to get content dimensions

Created on 20 Jan 2017  路  3Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[ x ] 2.x

I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
Content height or width returns 0.
image

Expected behavior:
Get integers values for both of them.

Steps to reproduce:
http://plnkr.co/edit/BsFOqg8PvxTonnmTKnsw?p=preview

Related code:
Check the plnkr.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0 
ios-sim version: 5.0.13 
OS: OS X El Capitan
Node Version: v7.4.0
Xcode version: Xcode 8.2.1 Build version 8C1002

All 3 comments

Seem to be due to the view event that you are using.
ionViewDidLoad fires before the DOM is ready, so the content has not been sized yet.

Switching to ionViewDidEnter makes sure that all the DOM is ready and has readable sizes.

http://plnkr.co/edit/azTN70MxDYAlnzlNNglD?p=info

Thanks @mhartington

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daveshirman picture daveshirman  路  3Comments

alexbainbridge picture alexbainbridge  路  3Comments

BilelKrichen picture BilelKrichen  路  3Comments

SebastianGiro picture SebastianGiro  路  3Comments

Macstyg picture Macstyg  路  3Comments