列表项中的href标签无法工作[重复]

时间:2022-08-22 16:56:27

This question already has an answer here:

这个问题已经有了答案:

What I need is to disable click on <a> tag that is in list item in ui list so it wont show include me <div> that i have on clicks(except for last list item). I tried with ng-disabled on list item attribute directly and also only in <a> tag to add ng-disabled but i am still able to click. Below is my view.

我需要的是禁用在ui列表中列表项中的标记,这样它就不会显示在单击时包含我的

 <div class="tab-pane">

    <ul class="nav nav-tabs nav-default tab-sm">
        <li class=""><a data-ng-click="vm.sub = 'one'" data-toggle="tab"><strong>
                    Text 1</strong></a>
        </li>
        <li class=""><a data-ng-click="vm.sub = 'two'" data-toggle="tab"><strong>
                    Text 2</strong></a>
        </li>
        <li class=""><a data-ng-click="vm.sub = 'three'" data-toggle="tab"><strong>
                    Text 3</strong></a>
        </li>
        <li id="viewAllItems" class="active pull-right"><a data-ng-click="vm.sub = 'four'" data-toggle="tab"><strong>
                    Text 4</strong></a>
        </li>
    </ul>

</div>

<div class="tab-content">
    <div data-ng-show="vm.sub == 'one'" data-ng-include="'src/app/....tpl.html'"></div>
    <div data-ng-show="vm.sub == 'two'" data-ng-include="'src/app/....tpl.html'"></div>
    <div data-ng-show="vm.sub == 'three'" data-ng-include="'src/app/....tpl.html'"></div>
    <div data-ng-show="vm.sub == 'four'" data-ng-include="'src/app/....tpl.html'"></div> <!-- ngRepeat inside of this template -->
</div>

I checked value for vm.enableClick it is false for sure.

我检查了vm的值。这肯定是假的。

1 个解决方案

#1


2  

You cannot use ng-disable on a <a> tag, instead you can use a class and the css property pointer-events:none so the click will go through the link.

您不能在标记上使用ng-disable,相反,您可以使用一个类和css属性指针事件:none,以便单击将通过链接。

#1


2  

You cannot use ng-disable on a <a> tag, instead you can use a class and the css property pointer-events:none so the click will go through the link.

您不能在标记上使用ng-disable,相反,您可以使用一个类和css属性指针事件:none,以便单击将通过链接。