【发布时间】:2021-12-06 03:06:36
【问题描述】:
我有一个简单的指令,我想给它添加一个类:
@Directive({
selector: '[appFieldLabel]',
})
export class FieldLabelDirective {
@Input() tooltip: string;
@Input() showOptional = true;
@HostBinding('class.text-truncate')
test = true;
}
这可行,但我希望它始终被设置,有没有办法不分配像这里test = true;这样的无用属性
谢谢
【问题讨论】:
-
还有更多选项可以做到这一点stackoverflow.com/questions/39639098/…