From 0f27e5ab6ec926a07ead5ec09a6efeb28dc35ac1 Mon Sep 17 00:00:00 2001 From: tinayuangao Date: Fri, 1 Sep 2017 08:09:53 -0700 Subject: [PATCH] demo(button): display snackbar when button is clicked (#6327) --- src/demo-app/a11y/button/button-a11y.html | 6 +++--- src/demo-app/a11y/button/button-a11y.ts | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/demo-app/a11y/button/button-a11y.html b/src/demo-app/a11y/button/button-a11y.html index 875f983c217..999a9c1e7b4 100644 --- a/src/demo-app/a11y/button/button-a11y.html +++ b/src/demo-app/a11y/button/button-a11y.html @@ -39,9 +39,9 @@

Buttons in different colors

- - - + + +
diff --git a/src/demo-app/a11y/button/button-a11y.ts b/src/demo-app/a11y/button/button-a11y.ts index 616e8252d54..aab2e3858c7 100644 --- a/src/demo-app/a11y/button/button-a11y.ts +++ b/src/demo-app/a11y/button/button-a11y.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; - +import {MdSnackBar} from '@angular/material'; @Component({ moduleId: module.id, @@ -10,7 +10,16 @@ import {Component} from '@angular/core'; export class ButtonAccessibilityDemo { counter: number = 0; + constructor(public snackBar: MdSnackBar) {} + + openSnackBar(message: string) { + this.snackBar.open(message, '', { + duration: 2000, + }); + } + increase() { this.counter++; + this.openSnackBar(`Click counter is set to ${this.counter}`); } }