Skip to content

Commit

Permalink
feat(md-tabs): handle onShow
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanood committed Nov 20, 2016
1 parent 94ce5b3 commit 57e3041
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AttributeManager } from '../common/attributeManager';
@inject(Element, TaskQueue)
export class MdTabs {
@bindable() fixed = false;
@bindable() onShow = null;
@bindable() transparent = false;

constructor(element, taskQueue) {
Expand All @@ -28,13 +29,18 @@ export class MdTabs {
this.tabAttributeManagers.push(setter);
});

// this.taskQueue.queueTask(() => {
$(this.element).tabs();
const self = this;
$(this.element).tabs({
onShow: function(jQueryElement) {
if (self.onShow) {
self.onShow({ element: jQueryElement});
}
}
});
let childAnchors = this.element.querySelectorAll('li a');
[].forEach.call(childAnchors, a => {
a.addEventListener('click', this.fireTabSelectedEvent);
});
// });
}

detached() {
Expand Down Expand Up @@ -80,7 +86,7 @@ export class MdTabs {
});
}

// FIXME: probably bad
// FIXME: probably bad - binding this introduces dirty checking
get selectedTab() {
let children = this.element.querySelectorAll('li.tab a');
let index = -1;
Expand Down

0 comments on commit 57e3041

Please sign in to comment.