What is the best way to conditionally apply a class?

后端 未结 22 2237
感动是毒
感动是毒 2020-11-22 09:12

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.

22条回答
  •  长情又很酷
    2020-11-22 09:37

    Check this.

    The infamous AngularJS if|else statement!!!
    When I started using Angularjs, I was a bit surprised that I couldn’t find an if/else statement.

    So I was working on a project and I noticed that when using the if/else statement, the condition shows while loading. You can use ng-cloak to fix this.

    Show this line

    Show this line instead

    .ng-cloak { display: none }

    Thanks amadou

提交回复
热议问题