Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.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
如何在angular 2中设置具有新属性的类_Angular - Fatal编程技术网

如何在angular 2中设置具有新属性的类

如何在angular 2中设置具有新属性的类,angular,Angular,我试图应用具有特定属性的特定类。 所以我有一节课: .k-plus::before { content: '\E601'; } 在模板中,我要设置一个条件: if(variable === 0)(*ngIf) 将类.k-plus::before应用于: .k-plus::before { content: ''; } 我该怎么做 谢谢 您可以像这样使用类绑定 <div [class.k-plus]="variable === 0" Hi,我的想法是我有一个

我试图应用具有特定属性的特定类。 所以我有一节课:

.k-plus::before {
  content: '\E601';
}
在模板中,我要设置一个条件:

if(variable === 0)(*ngIf) 
将类
.k-plus::before
应用于:

.k-plus::before {
      content: '';
    }
我该怎么做


谢谢

您可以像这样使用类绑定

<div [class.k-plus]="variable === 0"

Hi,我的想法是我有一个剑道网格,如果一行没有子行,我想删除+/-符号。你可以用ngIF-like绑定图标