mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
chore(menu): switch to OnPush change detection (#5518)
Switches the `md-menu` and `md-menu-item` components to `OnPush` change detection. Relates to #5035.
This commit is contained in:
committed by
mmalerba
parent
1efa594c6b
commit
173cdddd8f
@@ -19,6 +19,7 @@ import {
|
||||
ViewChild,
|
||||
ViewEncapsulation,
|
||||
ElementRef,
|
||||
ChangeDetectionStrategy,
|
||||
} from '@angular/core';
|
||||
import {MenuPositionX, MenuPositionY} from './menu-positions';
|
||||
import {throwMdMenuInvalidPositionX, throwMdMenuInvalidPositionY} from './menu-errors';
|
||||
@@ -35,6 +36,7 @@ import {ESCAPE} from '../core/keyboard/keycodes';
|
||||
selector: 'md-menu, mat-menu',
|
||||
templateUrl: 'menu.html',
|
||||
styleUrls: ['menu.css'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
animations: [
|
||||
transformMenu,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Component, ElementRef, ChangeDetectionStrategy} from '@angular/core';
|
||||
import {Focusable} from '../core/a11y/focus-key-manager';
|
||||
import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled';
|
||||
|
||||
@@ -31,8 +31,9 @@ export const _MdMenuItemMixinBase = mixinDisabled(MdMenuItemBase);
|
||||
'[attr.disabled]': 'disabled || null',
|
||||
'(click)': '_checkDisabled($event)',
|
||||
},
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
templateUrl: 'menu-item.html',
|
||||
exportAs: 'mdMenuItem'
|
||||
exportAs: 'mdMenuItem',
|
||||
})
|
||||
export class MdMenuItem extends _MdMenuItemMixinBase implements Focusable, CanDisable {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user