From 7b743ed4c62e2680c350d56daf57b202f15e63bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Ara=C3=BAjo?= Date: Tue, 17 Mar 2015 02:40:44 +0100 Subject: [PATCH] fix(button): Support ui-sref attribute natively. closes #1922. --- src/components/button/button.js | 2 +- src/components/button/button.spec.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/button/button.js b/src/components/button/button.js index 157c0e79029..bb658d24153 100644 --- a/src/components/button/button.js +++ b/src/components/button/button.js @@ -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) { diff --git a/src/components/button/button.spec.js b/src/components/button/button.spec.js index e9304a74a50..88a25b57aef 100644 --- a/src/components/button/button.spec.js +++ b/src/components/button/button.spec.js @@ -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('')($rootScope.$new()); + $rootScope.$apply(); + expect(button[0].tagName.toLowerCase()).toEqual('a'); + })); + it('should be button otherwise', inject(function($compile, $rootScope) { var button = $compile('')($rootScope.$new()); $rootScope.$apply();