@@ -21,6 +21,7 @@ import {MdRippleModule, coerceBooleanProperty} from '../core';
21
21
selector : 'button[md-button], button[md-raised-button], button[md-icon-button], ' +
22
22
'button[md-fab], button[md-mini-fab]' ,
23
23
host : {
24
+ '[attr.disabled]' : 'disabled' ,
24
25
'[class.md-button-focus]' : '_isKeyboardFocused' ,
25
26
'(mousedown)' : '_setMousedown()' ,
26
27
'(focus)' : '_setKeyboardFocus()' ,
@@ -42,11 +43,16 @@ export class MdButton {
42
43
43
44
/** Whether the ripple effect on click should be disabled. */
44
45
private _disableRipple : boolean = false ;
46
+ private _disabled : boolean = false ;
45
47
46
48
@Input ( )
47
49
get disableRipple ( ) { return this . _disableRipple ; }
48
50
set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
49
51
52
+ @Input ( )
53
+ get disabled ( ) { return this . _disabled ; }
54
+ set disabled ( value : boolean ) { this . _disabled = coerceBooleanProperty ( value ) ; }
55
+
50
56
constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
51
57
52
58
@Input ( )
@@ -103,16 +109,17 @@ export class MdButton {
103
109
el . hasAttribute ( 'md-mini-fab' ) ;
104
110
}
105
111
106
- isRippleEnabled ( ) {
107
- return ! this . disableRipple ;
112
+ _isRippleDisabled ( ) {
113
+ return this . disableRipple || this . disabled ;
108
114
}
109
115
}
110
116
111
117
@Component ( {
112
118
moduleId : module . id ,
113
119
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' ] ,
115
121
host : {
122
+ '[attr.disabled]' : 'disabled' ,
116
123
'[class.md-button-focus]' : '_isKeyboardFocused' ,
117
124
'(mousedown)' : '_setMousedown()' ,
118
125
'(focus)' : '_setKeyboardFocus()' ,
@@ -124,8 +131,6 @@ export class MdButton {
124
131
encapsulation : ViewEncapsulation . None
125
132
} )
126
133
export class MdAnchor extends MdButton {
127
- _disabled : boolean = null ;
128
-
129
134
constructor ( elementRef : ElementRef , renderer : Renderer ) {
130
135
super ( elementRef , renderer ) ;
131
136
}
@@ -141,15 +146,6 @@ export class MdAnchor extends MdButton {
141
146
return this . disabled ? 'true' : 'false' ;
142
147
}
143
148
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
-
153
149
_haltDisabledEvents ( event : Event ) {
154
150
// A disabled button shouldn't apply any actions
155
151
if ( this . disabled ) {
0 commit comments