有条件地申请课程的最佳方式是什么?

假如想象 提交于 2020-08-14 08:36:52

问题:

Lets say you have an array that is rendered in a ul with an li for each element and a property on the controller called selectedIndex . 假设你有一个在ul呈现的数组,每个元素都有一个li ,而控制器上的一个属性叫做selectedIndex What would be the best way to add a class to the li with the index selectedIndex in AngularJS? 什么是一类添加到最好的办法li与指数selectedIndex在AngularJS?

I am currently duplicating (by hand) the li code and adding the class to one of the li tags and using ng-show and ng-hide to show only one li per index. 我目前正在复制(手动) li代码并将类添加到其中一个li标签中,并使用ng-showng-hide仅显示每个索引一个li


解决方案:

参考一: https://stackoom.com/question/WhDw/有条件地申请课程的最佳方式是什么
参考二: https://oldbug.net/q/WhDw/What-is-the-best-way-to-conditionally-apply-a-class
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!