File tree 2 files changed +13
-4
lines changed
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>
39
39
40
40
< section >
41
41
< 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 >
45
45
</ section >
46
46
47
47
< section >
Original file line number Diff line number Diff line change 1
1
import { Component } from '@angular/core' ;
2
-
2
+ import { MdSnackBar } from '@angular/material' ;
3
3
4
4
@Component ( {
5
5
moduleId : module . id ,
@@ -10,7 +10,16 @@ import {Component} from '@angular/core';
10
10
export class ButtonAccessibilityDemo {
11
11
counter : number = 0 ;
12
12
13
+ constructor ( public snackBar : MdSnackBar ) { }
14
+
15
+ openSnackBar ( message : string ) {
16
+ this . snackBar . open ( message , '' , {
17
+ duration : 2000 ,
18
+ } ) ;
19
+ }
20
+
13
21
increase ( ) {
14
22
this . counter ++ ;
23
+ this . openSnackBar ( `Click counter is set to ${ this . counter } ` ) ;
15
24
}
16
25
}
You can’t perform that action at this time.
0 commit comments