Skip to content

Commit

Permalink
chore(menu): switch to OnPush change detection
Browse files Browse the repository at this point in the history
Switches the `md-menu` and `md-menu-item` components to `OnPush` change detection.

Relates to angular#5035.
  • Loading branch information
crisbeto committed Jul 5, 2017
1 parent 8ae4d9d commit 21beb21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/lib/menu/menu-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ViewChild,
ViewEncapsulation,
ElementRef,
ChangeDetectionStrategy,
} from '@angular/core';
import {MenuPositionX, MenuPositionY} from './menu-positions';
import {throwMdMenuInvalidPositionX, throwMdMenuInvalidPositionY} from './menu-errors';
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/lib/menu/menu-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 {

Expand Down

0 comments on commit 21beb21

Please sign in to comment.