Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

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

Closed
alanpurple opened this issue Jun 22, 2015 · 10 comments
Assignees
Milestone

Comments

@alanpurple
Copy link

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?

@epelc
Copy link
Contributor

epelc commented Jun 22, 2015

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

@hthetiot
Copy link

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])

@arusakov
Copy link

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

@thomasbertet
Copy link

👍 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.

@xtiggerk
Copy link

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.

@lrondanini
Copy link

same problem here! any suggestion?

@bvolders
Copy link

same problem here, can this be fixed ?

@dani3l
Copy link

dani3l commented Jul 3, 2015

+1 with ui-router

@diegolaciar
Copy link

+1 with ui-router ui-sref

@spock123
Copy link

// deleted, sorry guys my bad

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests