AngularJS ngclass,如果状态存在则删除类

时间:2014-12-14 09:00:59

标签: angularjs

我有以下身体标签

<body class="loaderParent" ng-class="">

如果$ state.includes(&#39; home&#39;),如何删除loaderParent类?

2 个答案:

答案 0 :(得分:2)

<body ngClass="{loaderParent: !$state.includes('home')}">

为什么不读the documentation

答案 1 :(得分:1)

您可以将对象放在ng-class中,如下所示:

<body ng-class="{ loaderParent: callControllerMethod() }">