-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor: move away from deprecated apis #3836
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import { | |
HostBinding, | ||
Input, | ||
OnDestroy, | ||
Renderer, | ||
Renderer2, | ||
ViewEncapsulation | ||
} from '@angular/core'; | ||
import {coerceBooleanProperty, FocusOriginMonitor} from '../core'; | ||
|
@@ -120,7 +120,7 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl | |
get disableRipple() { return this._disableRipple; } | ||
set disableRipple(v) { this._disableRipple = coerceBooleanProperty(v); } | ||
|
||
constructor(private _elementRef: ElementRef, private _renderer: Renderer, | ||
constructor(private _elementRef: ElementRef, private _renderer: Renderer2, | ||
private _focusOriginMonitor: FocusOriginMonitor) { | ||
super(); | ||
this._focusOriginMonitor.monitor(this._elementRef.nativeElement, this._renderer, true); | ||
|
@@ -143,13 +143,17 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl | |
|
||
_setElementColor(color: string, isAdd: boolean) { | ||
if (color != null && color != '') { | ||
this._renderer.setElementClass(this._getHostElement(), `mat-${color}`, isAdd); | ||
if (isAdd) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can kill this entire function now and just do the null check in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is used in a couple of other places, as well as inside the |
||
this._renderer.addClass(this._getHostElement(), `mat-${color}`); | ||
} else { | ||
this._renderer.removeClass(this._getHostElement(), `mat-${color}`); | ||
} | ||
} | ||
} | ||
|
||
/** Focuses the button. */ | ||
focus(): void { | ||
this._renderer.invokeElementMethod(this._getHostElement(), 'focus'); | ||
this._getHostElement().focus(); | ||
} | ||
|
||
_getHostElement() { | ||
|
@@ -191,7 +195,7 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl | |
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class MdAnchor extends MdButton { | ||
constructor(elementRef: ElementRef, renderer: Renderer, focusOriginMonitor: FocusOriginMonitor) { | ||
constructor(elementRef: ElementRef, renderer: Renderer2, focusOriginMonitor: FocusOriginMonitor) { | ||
super(elementRef, renderer, focusOriginMonitor); | ||
} | ||
|
||
|
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 is
NgModel
the right type here?