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:
Alex Rickabaugh
2019-05-10 13:27:40 -07:00
committed by Jeremy Elbourn
parent 03a9a39c49
commit 10c546ceed
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -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
View File
@@ -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 {