diff --git a/src/lib/core/compatibility/compatibility.ts b/src/lib/core/compatibility/compatibility.ts index 136e734d6740..beea05de9e50 100644 --- a/src/lib/core/compatibility/compatibility.ts +++ b/src/lib/core/compatibility/compatibility.ts @@ -65,6 +65,7 @@ export const MAT_ELEMENTS_SELECTOR = ` mat-tab, mat-tab-group, mat-toolbar, + matMenuTriggerFor, matTooltip`; /** Selector that matches all elements that may have style collisions with AngularJS Material. */ @@ -122,6 +123,7 @@ export const MD_ELEMENTS_SELECTOR = ` md-tab, md-tab-group, md-toolbar, + mdMenuTriggerFor, mdTooltip`; /** Directive that enforces that the `mat-` prefix cannot be used. */ diff --git a/src/lib/menu/menu-trigger.ts b/src/lib/menu/menu-trigger.ts index d295603a2a58..c77a51694c0b 100644 --- a/src/lib/menu/menu-trigger.ts +++ b/src/lib/menu/menu-trigger.ts @@ -32,7 +32,7 @@ import {MenuPositionX, MenuPositionY} from './menu-positions'; * responsible for toggling the display of the provided menu instance. */ @Directive({ - selector: '[md-menu-trigger-for], [mat-menu-trigger-for], [mdMenuTriggerFor]', + selector: `[md-menu-trigger-for], [mdMenuTriggerFor], [matMenuTriggerFor]`, host: { 'aria-haspopup': 'true', '(mousedown)': '_handleMousedown($event)', @@ -51,13 +51,18 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { // the first item of the list when the menu is opened via the keyboard private _openedByMouse: boolean = false; + /** References the menu instance that the trigger is associated with. */ + @Input('mdMenuTriggerFor') menu: MdMenuPanel; + /** @deprecated */ @Input('md-menu-trigger-for') get _deprecatedMenuTriggerFor(): MdMenuPanel { return this.menu; } set _deprecatedMenuTriggerFor(v: MdMenuPanel) { this.menu = v; } - /** References the menu instance that the trigger is associated with. */ - @Input('mdMenuTriggerFor') menu: MdMenuPanel; + // Property with `mat-` prefix for noconflict mode. + @Input('matMenuTriggerFor') + get _matMenuTriggerFor() { return this.menu; } + set _matMenuTriggerFor(v) { this.menu = v; } /** Event emitted when the associated menu is opened. */ @Output() onMenuOpen = new EventEmitter();