-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(button): apply color classes correctly. #195
Conversation
@@ -48,6 +57,18 @@ export class MdButton { | |||
TimerWrapper.setTimeout(() => { this.isMouseDown = false; }, 100); | |||
} | |||
|
|||
_updateColor(newColor: string) { | |||
if (this._color != null && this._color != '') { | |||
this.renderer.setElementClass(this.elementRef.nativeElement, `md-${newColor}`, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be this._color
in the template expression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed - fixed it, thanks!
0659ebe
to
2f337d1
Compare
|
||
if (newColor != null && newColor != '') { | ||
this.renderer.setElementClass(this.elementRef.nativeElement, `md-${newColor}`, true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of repetition between lines 61-63 and lines 65-67. Can you refactor to share more code, like:
_updateColor(newColor: string): void {
this._setElementColor(this._color, false);
this._setElementColor(newColor, true);
this._color = newColor;
}
_setElementColor(color: string, bool: boolean): void {
if (color != null && color != '') {
this.renderer.setElementClass(this.elementRef.nativeElement, `md-${color}`, bool);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kara Changed it as discussed. Thanks for the suggestion.
2f337d1
to
1b8b156
Compare
LGTM |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #75. Closes #89