components icon indicating copy to clipboard operation
components copied to clipboard

Unable to use dynamic tab size for tabs component - Uncaught TypeError: Cannot read property 'elementRef' of undefinedMdTabHeader

Open PoojaVM opened this issue 9 years ago • 5 comments

I am trying to use the property dynamicHeight for the tabs component as follows : <md-tab-group dynamicHeight [(selectedIndex)]="activeTabIndex"> as explained in the demo at here https://github.com/angular/material2/blob/master/src/demo-app/tabs/tabs-demo.html

Everything else works fine but as soon as I add the variable dynamicHeight to the md-tab-group selector and run it I get an error saying material.umd.js:12277 Uncaught TypeError: Cannot read property 'elementRef' of undefinedMdTabHeader._alignInkBarToSelectedTab @ material.umd.js:12277(anonymous function) @ material.umd.js:12065ZoneDelegate.invokeTask @ zone.js:265Zone.runTask @ zone.js:154ZoneTask.invoke @ zone.js:335data.args.(anonymous function) @ zone.js:970.

What can be done here?

PoojaVM avatar Feb 03 '17 11:02 PoojaVM

I don't get an error when running it locally. Can you post an example of it happening? You can use this as a template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd

crisbeto avatar Feb 03 '17 19:02 crisbeto

Thank you @crisbeto. I tried with the template you provided in the same way that I've done it locally. It's here : http://plnkr.co/edit/r9ZoENWacBX6uLfcX7oz?p=preview It's working here but the same when I do on my local I am getting the error. I cannot understand why this is happening.

PoojaVM avatar Feb 05 '17 10:02 PoojaVM

It might be caused by something that we fixed, but haven't released yet. You can try the latest changes from master by running:

npm install https://github.com/angular/material2-builds.git

crisbeto avatar Feb 05 '17 10:02 crisbeto

It's working fine with this version: https://github.com/angular/material2-builds.git Thanks a lot for the help. It really bugs me though that I cannot find the reason why the version I was perviously using wasn't working for dynamic height.

PoojaVM avatar Feb 07 '17 06:02 PoojaVM

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.