@@ -21,6 +21,7 @@ import {MdRippleModule, coerceBooleanProperty} from '../core';
2121 selector : 'button[md-button], button[md-raised-button], button[md-icon-button], ' +
2222 'button[md-fab], button[md-mini-fab]' ,
2323 host : {
24+ '[attr.disabled]' : 'disabled' ,
2425 '[class.md-button-focus]' : '_isKeyboardFocused' ,
2526 '(mousedown)' : '_setMousedown()' ,
2627 '(focus)' : '_setKeyboardFocus()' ,
@@ -42,11 +43,16 @@ export class MdButton {
4243
4344 /** Whether the ripple effect on click should be disabled. */
4445 private _disableRipple : boolean = false ;
46+ private _disabled : boolean = false ;
4547
4648 @Input ( )
4749 get disableRipple ( ) { return this . _disableRipple ; }
4850 set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
4951
52+ @Input ( )
53+ get disabled ( ) { return this . _disabled ; }
54+ set disabled ( value : boolean ) { this . _disabled = coerceBooleanProperty ( value ) ; }
55+
5056 constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
5157
5258 @Input ( )
@@ -103,16 +109,17 @@ export class MdButton {
103109 el . hasAttribute ( 'md-mini-fab' ) ;
104110 }
105111
106- isRippleEnabled ( ) {
107- return ! this . disableRipple ;
112+ _isRippleDisabled ( ) {
113+ return this . disableRipple || this . disabled ;
108114 }
109115}
110116
111117@Component ( {
112118 moduleId : module . id ,
113119 selector : 'a[md-button], a[md-raised-button], a[md-icon-button], a[md-fab], a[md-mini-fab]' ,
114- inputs : [ 'color' ] ,
120+ inputs : [ 'color' , 'disabled' , 'disableRipple' ] ,
115121 host : {
122+ '[attr.disabled]' : 'disabled' ,
116123 '[class.md-button-focus]' : '_isKeyboardFocused' ,
117124 '(mousedown)' : '_setMousedown()' ,
118125 '(focus)' : '_setKeyboardFocus()' ,
@@ -124,8 +131,6 @@ export class MdButton {
124131 encapsulation : ViewEncapsulation . None
125132} )
126133export class MdAnchor extends MdButton {
127- _disabled : boolean = null ;
128-
129134 constructor ( elementRef : ElementRef , renderer : Renderer ) {
130135 super ( elementRef , renderer ) ;
131136 }
@@ -141,15 +146,6 @@ export class MdAnchor extends MdButton {
141146 return this . disabled ? 'true' : 'false' ;
142147 }
143148
144- @HostBinding ( 'attr.disabled' )
145- @Input ( 'disabled' )
146- get disabled ( ) { return this . _disabled ; }
147-
148- set disabled ( value : boolean ) {
149- // The presence of *any* disabled value makes the component disabled, *except* for false.
150- this . _disabled = ( value != null && value != false ) ? true : null ;
151- }
152-
153149 _haltDisabledEvents ( event : Event ) {
154150 // A disabled button shouldn't apply any actions
155151 if ( this . disabled ) {
0 commit comments