angularjs ng-click 和 href 锚点 [英] angularjs ng-click and href on anchor

查看:30
本文介绍了angularjs ng-click 和 href 锚点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果锚点上同时存在 ng-click 和 href,则 ng-click 不起作用.如果可能的话,我希望两者都能工作,去一条路线然后运行一个功能.我的用例是我打开了一个带有链接面板的抽屉,当我想关闭一个链接时,我想关闭抽屉.

If there's an ng-click and a href together on an anchor the ng-click doesn't work. I want both to work if possible, go to a route and then run a function. My use-case is I have a drawer open with a panel of links, when going to a link I want to close the drawer.

让两者同时工作的简单方法是什么?

What's an easy way to get both working at the same time?

推荐答案

问题是问错了.将 href 和 ng-click 一起使用效果很好,我只是在父元素中有一个 ui-view,它根本阻止了任何角度绑定的工作.

The question was asking for the wrong thing. Using the href and the ng-click together works perfectly fine, I just had an ui-view in the parent element that prevented any angular bindings from working at all.

这篇关于angularjs ng-click 和 href 锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆