File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,9 @@ <h2>Anchor elements</h2>
3939
4040 < section >
4141 < h2 > Buttons in different colors</ h2 >
42- < button md-button color ="primary "> Primary</ button >
43- < button md-button color ="accent "> Accent</ button >
44- < button md-button color ="warn "> Warn</ button >
42+ < button md-button color ="primary " (click) =" openSnackBar('Color is primary.') " > Primary</ button >
43+ < button md-button color ="accent " (click) =" openSnackBar('Color is accent.') " > Accent</ button >
44+ < button md-button color ="warn " (click) =" openSnackBar('Color is warn.') " > Warn</ button >
4545 </ section >
4646
4747 < section >
Original file line number Diff line number Diff line change 11import { Component } from '@angular/core' ;
2-
2+ import { MdSnackBar } from '@angular/material' ;
33
44@Component ( {
55 moduleId : module . id ,
@@ -10,7 +10,16 @@ import {Component} from '@angular/core';
1010export class ButtonAccessibilityDemo {
1111 counter : number = 0 ;
1212
13+ constructor ( public snackBar : MdSnackBar ) { }
14+
15+ openSnackBar ( message : string ) {
16+ this . snackBar . open ( message , '' , {
17+ duration : 2000 ,
18+ } ) ;
19+ }
20+
1321 increase ( ) {
1422 this . counter ++ ;
23+ this . openSnackBar ( `Click counter is set to ${ this . counter } ` ) ;
1524 }
1625}
You can’t perform that action at this time.
0 commit comments