-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat(list): add support for md-menu as proxied element #6459
Conversation
67ceec4
to
f0fc577
Compare
f0fc577
to
e84fdff
Compare
var buttonEl = menuEl.find('md-button') || menuEl.find('button'); | ||
if (!buttonEl || !buttonEl[0].parentNode == menuEl[0]) return; | ||
|
||
if (!buttonEl[0].hasAttribute('ng-click')) buttonEl[0].setAttribute('ng-click', '$mdOpenMenu($event)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good way? @EladBezalel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by good way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, setting the ng-click
attribute 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first i would say you should use buttonEl.attr
like the row below.
Secondly, this whole function feels odd to me.
Care to explain what your initial thought on this issue/PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is old, I will change a few things.
The initial thought was, adding support for show a md-menu
as a second element
/ second action
/ proxy element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EladBezalel - Updated the issue description + commit message + changed title + improved code.
e84fdff
to
4341385
Compare
4341385
to
766eec5
Compare
menuEl.attr('md-position-mode', (isLeftAligned ? 'target target' : 'target-right target')); | ||
|
||
// Apply menu open binding to menu button | ||
var menuOpenButton = menuEl.children().eq(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a weird line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used by the original menu too (See here). I already had find
, and validating the right parent. I think using the first children is the right way to get the triggering element.
666308c
to
6ab2e2b
Compare
@devversion - please rebase, then LGTM for 1.1.0. |
6ab2e2b
to
f9c8f42
Compare
* Allow md-menu to be a proxied element in a list * Smart detection of being right or left aligned * Allows md-menu to be a secondary element * Support for RTL pages, automatically detecting the menu origin. Fixes angular#3339
f9c8f42
to
c7fd83c
Compare
@ThomasBurleson This is now rebased and updated.
|
Preview (Secondary Item):
Fixes #3339