99 Type ,
1010 NgModule ,
1111} from '@angular/core' ;
12+ import { MD_RIPPLE_DIRECTIVES } from '@angular2-material/core/core' ;
13+ import { BooleanFieldValue } from '@angular2-material/core/annotations/field-value' ;
1214
13- // TODO(jelbourn): Ink ripples.
1415// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
1516// TODO(kara): Convert attribute selectors to classes when attr maps become available
1617
@@ -28,6 +29,7 @@ import {
2829 } ,
2930 templateUrl : 'button.html' ,
3031 styleUrls : [ 'button.css' ] ,
32+ directives : [ MD_RIPPLE_DIRECTIVES ] ,
3133 encapsulation : ViewEncapsulation . None ,
3234 changeDetection : ChangeDetectionStrategy . OnPush ,
3335} )
@@ -40,6 +42,9 @@ export class MdButton {
4042 /** Whether a mousedown has occurred on this element in the last 100ms. */
4143 _isMouseDown : boolean = false ;
4244
45+ /** Whether the ripple effect on click should be disabled. */
46+ @Input ( ) @BooleanFieldValue ( ) disableRipple : boolean = false ;
47+
4348 constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
4449
4550 get color ( ) : string {
@@ -83,6 +88,21 @@ export class MdButton {
8388 focus ( ) {
8489 this . _elementRef . nativeElement . focus ( ) ;
8590 }
91+
92+ getHostElement ( ) {
93+ return this . _elementRef . nativeElement ;
94+ }
95+
96+ isRoundButton ( ) {
97+ const el = this . _elementRef . nativeElement ;
98+ return el . hasAttribute ( 'md-icon-button' ) ||
99+ el . hasAttribute ( 'md-fab' ) ||
100+ el . hasAttribute ( 'md-mini-fab' ) ;
101+ }
102+
103+ isRippleEnabled ( ) {
104+ return ! this . disableRipple ;
105+ }
86106}
87107
88108@Component ( {
@@ -98,6 +118,7 @@ export class MdButton {
98118 } ,
99119 templateUrl : 'button.html' ,
100120 styleUrls : [ 'button.css' ] ,
121+ directives : [ MD_RIPPLE_DIRECTIVES ] ,
101122 encapsulation : ViewEncapsulation . None
102123} )
103124export class MdAnchor extends MdButton {
0 commit comments