javascript - angularjs ng-click and href on anchor -


if there's ng-click , href on anchor ng-click doesn't work. want both work if possible, go route , run function. use-case have drawer open panel of links, when going link want close drawer.

what's easy way both working @ same time?

once navigate away page scripts no longer run.*

your flow can like:

when user clicks, run function following:

  • run original function wanted run
  • handle 'navigate away in specific case' logic.
  • change location.href url want to navigate to.

it's of course possible extract behavior directive if find implementing bit of logic on , on :)

* can use onbeforeunload that's not plenty of other reasons


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -