Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在我的案例中如何设置多个类?_Html_Css_Angularjs_Class - Fatal编程技术网

Html 在我的案例中如何设置多个类?

Html 在我的案例中如何设置多个类?,html,css,angularjs,class,Html,Css,Angularjs,Class,我正在尝试在我的应用程序的ng类中设置多个条件。我有点像 <div id='wrapper' ng-class="{red: !isBlue(), highlight ? 'yellow' : 'black'}" ng-show="test">Test</div> 我的问题是在ng类条件下出现语法错误 Syntax Error: Token ';' is unexpected, expecting [}

我正在尝试在我的应用程序的ng类中设置多个条件。我有点像

 <div id='wrapper' ng-class="{red: !isBlue(), 
                              highlight ? 'yellow' : 'black'}" 
 ng-show="test">Test</div>
我的问题是在ng类条件下出现语法错误

Syntax Error: Token ';' is unexpected, expecting [}] at column 48...

我不知道如何修理它。有人能帮我吗?谢谢

您可以像这样使用多个类,您需要为
高亮显示
添加单独的类!突出显示

<div id='wrapper' 
                ng-class="{'red': !isBlue(), 'yellow':highlight ,'black':!highlight }"
                ng-show="test">
       Test
</div>
这是演示

<div id='wrapper' 
                ng-class="{'red': !isBlue(), 'yellow':highlight ,'black':!highlight }"
                ng-show="test">
       Test
</div>
<div id='wrapper' ng-style="{color: (highlight ? 'yellow' : 'green')}" ng-show="test">Test</div>