material icon indicating copy to clipboard operation
material copied to clipboard

<md-menu> only close with md-button with ng-click, need to be same with ng-href

Open alanpurple opened this issue 11 years ago • 10 comments

md-menu-item md-button ng-href="/user-info">Edit User Info</md-button /md-menu-item>

currently this needs to be

md-menu-item> md-button ng-click="" ng-href="/user-info">Edit User Info</md-button /md-menu-item>

make ng-href works same as ng-click, doesn't this look natural?

alanpurple avatar Jun 22 '15 17:06 alanpurple

If this is a problem I'd suspect ui-sref has the same issue.

epelc avatar Jun 22 '15 18:06 epelc

The current implementation can also lead to following JS error.

Uncaught TypeError: target.hasAttribute is not a function

Caused by the function that is trigger when you close the menu.

 do {
-   if (target && target.hasAttribute('ng-click')) {
+   if (target && target.nodeType == 1 && target.hasAttribute('ng-click')) {
      if (!target.hasAttribute('disabled')) {
        close();
      }
      break;
    }
- } while ((target = target.parentNode) && target != opts.menuContentEl)
+ } while ((target = target.parentNode) && target != opts.menuContentEl[0])

hthetiot avatar Jun 22 '15 22:06 hthetiot

@hthetiot Faced with the same problem! Create PR. Why "target.nodeType == 1" there?

arusakov avatar Jun 23 '15 09:06 arusakov

:+1: Faced this issue. I'm using ui-sref / ng-href.

Maybe a copepen could help : http://codepen.io/anon/pen/yNPOBV

-> Click on the first "Redial" menu item, and see the error thrown.

thomasbertet avatar Jun 23 '15 09:06 thomasbertet

There is also a problem using 'data-ng-click' instead of 'ng-click'. Actually it doesn't work with 'data' prefix (FF and Chrome), works fine with ng-click.

xtiggerk avatar Jun 26 '15 08:06 xtiggerk

same problem here! any suggestion?

lrondanini avatar Jun 29 '15 03:06 lrondanini

same problem here, can this be fixed ?

bvolders avatar Jun 29 '15 10:06 bvolders

+1 with ui-router

dani3l avatar Jul 03 '15 15:07 dani3l

+1 with ui-router ui-sref

diegolaciar avatar Aug 03 '15 07:08 diegolaciar

// deleted, sorry guys my bad

spock123 avatar Aug 18 '15 20:08 spock123