如何在angularjs中创建选项卡 [英] How to create tabs in angularjs

查看:78
本文介绍了如何在angularjs中创建选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据用户在ng-repeat中的angularjs中的点击隐藏或显示标签.

这是我的示例 jquery中的codepen 它使用

  $(this).attr 

我们如何在angularjs中做到这一点

解决方案

如果您想编写自己的解决方案.在集合上添加一个属性,例如 selectedItem ,然后通过标签页眉上的 ng-click 进行设置.

然后,您可以在各自生成的div上向其各自的div添加 ng-show ="item.$ parent.selectedItem === item" ./p>

How to hide or show tabs according to user clicks in angularjs in ng-repeat.

this is my sample codepen in jquery it use

 $(this).attr

how can we do it in angularjs

解决方案

If you'd like to code your own solution. On the collection add a property e.g. selectedItem and set that via ng-click on the tab header.

On the respective generated div you can then add a ng-show="item.$parent.selectedItem === item" to the respective div and you get a rather simple tab control.

这篇关于如何在angularjs中创建选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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