Skip to content

Commit

Permalink
fix(md-tabs): add refresh method to support dynamic tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Dec 22, 2016
1 parent a528a9b commit be904a8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ export class MdTabs {
});
}

refresh() {
this.taskQueue.queueTask(() => {
let hrefs = [];
$('li a', this.element).each(function(i, tab) {
$(tab).parent().addClass('tab');
hrefs.push($(tab).attr('href'));
});
$(hrefs).each((i, tab) => {
if (this.selectedTab.index != i) {
$(tab).hide();
}
});
this.taskQueue.queueTask(() => {
// window resize adjusts Materialize tab indicator
$(window).trigger('resize');
});
});
}

fixedChanged(newValue) {
if (newValue) {
this.attributeManager.addClasses('tabs-fixed-width');
Expand Down

0 comments on commit be904a8

Please sign in to comment.