当ng-class(condicional)为真时,为什么UL中的href不起作用 [英] Why a href in a UL does not work when the ng-class (condicional) is true

查看:68
本文介绍了当ng-class(condicional)为真时,为什么UL中的href不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签列表,我在一个div中一次显示7个标签,其中包含以下代码。



I have a list of tabs which I show them from 7 at a time within a div with the following code.

<div>
<ul class="nav nav-tabs" style="margin-left: 10px; width: 750px; float: left;">
    <li ng-repeat="tab in contentBar.tabs | orderBy: 'order_tab' | startFromGrid: currentPage * pageSize | limitTo: pageSize"
        ng-init="setFirstActiveTab('#'+ tab.tabDesign.id_tab_design.toString() + contentBar.id_content_bar.toString())"
        ng-click="ActiveTab($event)"
        ng-class="{active: selectedTab == ('#'+ tab.tabDesign.id_tab_design.toString() + contentBar.id_content_bar.toString())}">
        <a class="fonts"
           ng-href="#{{tab.tabDesign.id_tab_design.toString() + contentBar.id_content_bar.toString()}}"
           data-toggle="tab">
            {{tab.tabDesign.ui_tab_name}}
        </a>
    </li>
</ul>
</div>







我尝试过:



使用ActiveTab方法,将刚刚选择的选项卡的ID设置为变量selectedTab。然后通过对ng-class的评估,我确定选项卡是否应该是活动的,这是因为当以7个为一组显示选项卡时,应该对其进行分页,并且应该维护最后一个活动选项卡。



问题是当在ng-class中时条件给出了真实的结果,当点击不同的标签时它们保持静态,也就是说,它们不会浏览,但如果是最后一个在页面制作时,选定的一个保持活动状态。



可能发生的是什么,href在这种情况下不工作?




What I have tried:

With the "ActiveTab" method, set the id of the tab that you just selected to the variable "selectedTab". Then with the evaluation of the ng-class, I determine if the tab should be Active or not, this because when displaying the tabs in groups of 7, it should be paged and the last active tab should be maintained.

The problem is that when in the ng-class the condition gives a true result, when clicking on the different tabs they remain static, that is, they do not browse, but if the last selected one remains active when the page is made.

What is it that may be happening, that the href is not working in this condition?

推荐答案

event)
ng-class ={active:selectedTab ==('#'+ tab.tabDesign.id_tab_design.toString()+ contentBar.id_content_bar.toString( ))>
< a class =fonts
ng-href =#{{tab.tabDesign.id_tab_design.toString()+ contentBar.id_content_bar.toString()}}
data-toggle =tab>
{{tab.tabDesign.ui_tab_name}}
< / A>
< / li>
< / ul>
< / div>
event)" ng-class="{active: selectedTab == ('#'+ tab.tabDesign.id_tab_design.toString() + contentBar.id_content_bar.toString())}"> <a class="fonts" ng-href="#{{tab.tabDesign.id_tab_design.toString() + contentBar.id_content_bar.toString()}}" data-toggle="tab"> {{tab.tabDesign.ui_tab_name}} </a> </li> </ul> </div>







我尝试过:



使用ActiveTab方法,将刚刚选择的选项卡的ID设置为变量selectedTab。然后通过对ng-class的评估,我确定选项卡是否应该是活动的,这是因为当以7个为一组显示选项卡时,应该对其进行分页,并且应该维护最后一个活动选项卡。



问题是当在ng-class中时条件给出了真实的结果,当点击不同的标签时它们保持静态,也就是说,它们不会浏览,但如果是最后一个在制作页面时,选定的一个保持活动状态。



可能发生的情况是什么,href在这种情况下不起作用?




What I have tried:

With the "ActiveTab" method, set the id of the tab that you just selected to the variable "selectedTab". Then with the evaluation of the ng-class, I determine if the tab should be Active or not, this because when displaying the tabs in groups of 7, it should be paged and the last active tab should be maintained.

The problem is that when in the ng-class the condition gives a true result, when clicking on the different tabs they remain static, that is, they do not browse, but if the last selected one remains active when the page is made.

What is it that may be happening, that the href is not working in this condition?


这篇关于当ng-class(condicional)为真时,为什么UL中的href不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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