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

Commit

Permalink
fix(button): Support ui-sref attribute natively.
Browse files Browse the repository at this point in the history
closes #1922.
  • Loading branch information
ruiaraujo authored and Marcy Sutton committed Mar 24, 2015
1 parent d484fc8 commit 7b743ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function MdButtonDirective($mdInkRipple, $mdTheming, $mdAria) {
};

function isAnchor(attr) {
return angular.isDefined(attr.href) || angular.isDefined(attr.ngHref);
return angular.isDefined(attr.href) || angular.isDefined(attr.ngHref) || angular.isDefined(attr.uiSref);
}

function getTemplate(element, attr) {
Expand Down
6 changes: 6 additions & 0 deletions src/components/button/button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ describe('md-button', function() {
expect(button[0].tagName.toLowerCase()).toEqual('a');
}));

it('should be anchor if ui-sref attr', inject(function($compile, $rootScope) {
var button = $compile('<md-button ui-sref="state">')($rootScope.$new());
$rootScope.$apply();
expect(button[0].tagName.toLowerCase()).toEqual('a');
}));

it('should be button otherwise', inject(function($compile, $rootScope) {
var button = $compile('<md-button>')($rootScope.$new());
$rootScope.$apply();
Expand Down

0 comments on commit 7b743ed

Please sign in to comment.