Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(tabs): internal scope will now be the same as external scope
Browse files Browse the repository at this point in the history
Closes #3300
  • Loading branch information
Robert Messerle committed Jul 20, 2015
1 parent 7fff84a commit c5c148d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/tabs/js/templateDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function MdTemplate ($compile, $mdUtil) {
};
function link (scope, element, attr, ctrl) {
if (!ctrl) return;
var compileScope = scope.compileScope.$new();
var compileScope = scope.compileScope;
element.html(scope.template);
$compile(element.contents())(compileScope);
element.on('DOMSubtreeModified', function () {
Expand Down
20 changes: 20 additions & 0 deletions src/components/tabs/tabs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,24 @@ describe('<md-tabs>', function () {
expect(tab.find('md-tab-body').length).toBe(0);
});
});

describe('internal scope', function () {
it('should have the same internal scope as external', function () {
var template = '\
<md-tabs md-selected="selectedTab">\
<md-tab label="a">\
<md-button ng-click="data = false">Set data to false</md-button>\
</md-tab>\
</md-tabs>\
';
var element = setup(template);
var button = element.find('md-button');

expect(button[0 ].tagName).toBe('MD-BUTTON');

button.triggerHandler('click');

expect(element.scope().data).toBe(false);
});
});
});

0 comments on commit c5c148d

Please sign in to comment.