From 41fac64256620135d8f978b28a92f7e4f240ce97 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Mon, 14 Dec 2015 14:00:20 -0500 Subject: [PATCH] fix(button): add button-disabled class when disabled attribute is on button closes #741 --- ionic/components/app/normalize.scss | 2 +- ionic/components/button/button.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ionic/components/app/normalize.scss b/ionic/components/app/normalize.scss index 35616127fd..578b1038a0 100644 --- a/ionic/components/app/normalize.scss +++ b/ionic/components/app/normalize.scss @@ -127,7 +127,7 @@ button { } // Re-set default cursor for disabled elements. -button[disabled], +.button-disabled, html input[disabled] { cursor: default; } diff --git a/ionic/components/button/button.ts b/ionic/components/button/button.ts index 8b96cb7b21..5de9bb8c7b 100644 --- a/ionic/components/button/button.ts +++ b/ionic/components/button/button.ts @@ -14,6 +14,7 @@ import {Toolbar} from '../toolbar/toolbar'; * @property [full] - for a full width button * @property [small] - sets button size to small * @property [large] - sets button size to large + * @property [disabled] - disables the button * @property [fab] - for a floating action button * @property [fab-left] - position a fab button to the left * @property [fab-right] - position a fab button to the right @@ -43,6 +44,7 @@ export class Button { this._display = null; // block/full this._colors = []; // primary/secondary this._icon = null; // left/right/only + this._disabled = false; // disabled let element = elementRef.nativeElement; @@ -56,6 +58,10 @@ export class Button { return; } + if (element.hasAttribute('disabled')) { + this._disabled = true; + } + this._readAttrs(element); this._readIcon(element); }