📅  最后修改于: 2022-03-11 14:55:16.157000             🧑  作者: Mango
@Directive({
selector: '[myDirective]'
})
export class parameterDirective implements OnInit, OnChanges {
@Input('myDirective') parameter: parameter;
@Input() myServiceValue: string;
constructor(private el: ElementRef, private renderer: Renderer) {
}
ngOnInit(): void {
}
ngOnChanges(changes: SimpleChanges): void {
switch (this.parameter) {
case parameter.EnumValue:
this.renderer.setElementClass(this.el.nativeElement, "my-class", changes.myServiceValue.currentValue > 100);
break;
default:
}
}
}