我正在使用 Angular.js 创建一个简单的选项卡式界面,但我想active
在我刚刚单击的任何链接上切换一个类。这是我的代码
<header>
<nav>
<a href ng:click="selected=1">Home</a>
<a href ng:click="selected=2">About</a>
<a href ng:click="selected=3">Work</a>
<a href ng:click="selected=4">Blog</a>
<a href ng:click="selected=5">Login</a>
</nav>
</header>
<article ng:hide="selected == 2 || selected == 3 || selected == 4 || selected == 5" >
<section>
<h2>1</h2>
</section>
</article>
<article ng:show="selected == 2">
<section>
<h2>2</h2>
</section>
</article>
<article ng:show="selected == 3">
<section>
<h2>3</h2>
</section>
</article>
<article ng:show="selected == 4">
<section>
<h2>4</h2>
</section>
</article>
<article ng:show="selected == 5">
<section>
<h2>5</h2>
</section>
</article>
我还做了一个 CodePen。任何帮助将不胜感激!