css - How to achieve the switching effect of multiple buttons without routing in Angular2?
漂亮男人
漂亮男人 2017-05-15 17:13:11
0
3
769

How to achieve the effect that when a button is clicked without routing, the background color of the current button turns blue, and the background color of other buttons remains gray?

漂亮男人
漂亮男人

reply all(3)
黄舟

You should ask and answer your own questions. This effect has been achieved through the ng2 command. For details, please see:
http://tc9011.com/2017/03/03/...

曾经蜡笔没有小新
ng-class满足不了吗
    <p ng-class="{true: 'green', false: 'red'}[isA[0]]"></p>
    <p ng-class="{true: 'green', false: 'red'}[isA[1]]"></p>
点击事件去修改isA数组
伊谢尔伦
After reading your blog post, although the principles are the same, I still feel that your approach may be complicated. Post it here for you to take a look :)

The best practice I personally think is the solution that the angular-router module has provided us: the routerLinkActive directive.
Click here for code sample

That's all...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template