MdTab: Add property to determine if the tab is active #6422
Labels
feature
This issue represents a new feature or feature request rather than a bug or bug fix
help wanted
The team would appreciate a PR from the community to address this issue
P4
A relatively minor issue that is not relevant to core functions
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 inMdTabGroup
. Even then, it returns an index, rather than an instance ofMdTab
. There does not seem to be a straightforward way to get theMdTab
instance based on the index, other than to useMdTabGroup._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:
However, to my knowledge, there is no such property as
isActive
(or similar) available onMdTab
.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
2.0.0-beta.8
The text was updated successfully, but these errors were encountered: