mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor: don't depend on @Inject for _MatMenuBase DI (#15975)
In Ivy, undecorated base classes (like _MatMenuBase) don't have the same behavior as View Engine; specifically, inheriting the constructor from the base class will not work in the DI system. Even in View Engine this was often counter-intuitive - only constructors with DI decorators would be properly inherited in JIT. This commit updates _MatMenuBase to not rely on this implementation detail of Angular, and instead moves the injected constructor onto _MatMenu itself.
This commit is contained in:
committed by
Jeremy Elbourn
parent
03a9a39c49
commit
10c546ceed
@@ -445,4 +445,9 @@ export class MatMenu extends _MatMenuBase {}
|
||||
})
|
||||
// tslint:disable-next-line:class-name
|
||||
export class _MatMenu extends MatMenu {
|
||||
|
||||
constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone,
|
||||
@Inject(MAT_MENU_DEFAULT_OPTIONS) defaultOptions: MatMenuDefaultOptions) {
|
||||
super(elementRef, ngZone, defaultOptions);
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
export declare class _MatMenu extends MatMenu {
|
||||
constructor(elementRef: ElementRef<HTMLElement>, ngZone: NgZone, defaultOptions: MatMenuDefaultOptions);
|
||||
}
|
||||
|
||||
export declare class _MatMenuBase implements AfterContentInit, MatMenuPanel<MatMenuItem>, OnInit, OnDestroy {
|
||||
|
||||
Reference in New Issue
Block a user