[英]AngularJS ui-router: ui-sref and directive
I have such html:我有这样的html:
<span ui-sref="{{detailsArt(art.Id)}}" check-val></span>
and in my directive check-val i have:在我的指令 check-val 中,我有:
link: function(scp, el, attr) {
el.bind('click', function(event) {
//some logic with if:
event.preventDefault();
});
}
and it's not working with ui-sref(它不适用于 ui-sref(
when i'm using $state.go('detailsArt', {artId: art.Id})
this directive is working fine.当我使用
$state.go('detailsArt', {artId: art.Id})
这个指令工作正常。
Is it possible to use ui-sref with directive click handler, and how?是否可以将 ui-sref 与指令单击处理程序一起使用,以及如何使用?
因为它应该是: ui-sref="detailsArt({artId : art.Id})"
当然你需要一个锚标签a
正如 Pankaj 所说
<a ui-sref="detailsArt({artId: art.Id})" check-val></a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.