Description
Bug, feature request, or proposal:
Feature request
What is the expected behavior?
It would be helpful to have a property on MdTab
that returns true if it is the currently active tab.
What is the current behavior?
Seems like the only way to get the active tab is via the selectedIndex
property in MdTabGroup
. Even then, it returns an index, rather than an instance of MdTab
. There does not seem to be a straightforward way to get the MdTab
instance based on the index, other than to use MdTabGroup._tabs.find
(which also doesn't seem right, since _tabs
is not part of the public API).
What is the use-case or motivation for changing an existing behavior?
Lots of reasons why someone might want this. In my case, I'm trying to avoid instantiating a component until the tab gets selected (partly for performance, and also because the component does not function correctly if it is initially rendered in a hidden container).
Ideally, I would like to do something like this:
<md-tab-group>
<md-tab #mapTab label="Map">
<div *ngIf="mapTab.isActive">
<agm-map ...></agm-map>
</div>
</md-tab>
</md-tab-group>
However, to my knowledge, there is no such property as isActive
(or similar) available on MdTab
.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
2.0.0-beta.8