-
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
refactor: move away from deprecated apis #3836
Conversation
1ef8835
to
7579ed8
Compare
@@ -5,7 +5,7 @@ import { | |||
ComponentFixture, | |||
TestBed, | |||
} from '@angular/core/testing'; | |||
import {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms'; | |||
import {NgModel, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms'; |
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?
@@ -141,13 +141,17 @@ export class MdButton implements OnDestroy { | |||
|
|||
_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 comment
The 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 _updateColor
and call addClass
/ removeClass
directly there.
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.
This one is used in a couple of other places, as well as inside the button.html
so it may be more convenient to keep it. Otherwise we'd need to do this._elementRef.nativeElement
all over the place.
src/lib/core/ripple/ripple.ts
Outdated
export type RippleGlobalOptions = { | ||
disabled?: boolean; | ||
baseSpeedFactor?: number; | ||
}; | ||
|
||
/** Injection token that can be used to specify the global ripple options. */ | ||
export const MD_RIPPLE_GLOBAL_OPTIONS = new InjectionToken<RippleGlobalOptions>( |
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.
Generally prefer line breaking at the higher syntactic level, e.g.:
export const MD_RIPPLE_GLOBAL_OPTIONS =
new InjectionToken<RippleGlobalOptions>('md-ripple-global-options');
(at the assignment)
7579ed8
to
87e7f79
Compare
Rebased and addressed some of the feedback @jelbourn. |
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.
LGTM
This is a breaking change because Caretaker will need to update Google call sites. |
584aa2a
to
51c6d92
Compare
Rebased. Should I remove the |
afff9f5
to
dd3329e
Compare
Moves away from the APIs that were deprecated in Angular 4. They include: * Switching from using `OpaqueToken` to `InjectionToken`. * Moving from `Renderer` to `Renderer2`. * Changing the `Injector.get(thing: any)` usages to use the new signature `Injector.get<T>(thing: T)`.
dd3329e
to
1c03ac6
Compare
It looks like the presubmit failures are because one of the teams in google is injecting the |
It may be better to refactor it. We could have a solution that accepts both, but it would add some bloat and at some point we'll have to deprecate it anyway. |
@mmalerba if it's not widespread we should just change the team's code |
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. |
Moves away from the APIs that were deprecated in Angular 4. They include:
OpaqueToken
toInjectionToken
.Renderer
toRenderer2
.Injector.get(thing: any)
usages to use the new signatureInjector.get<T>(thing: T)
.