I want to have conditional styleUrls
within my component decorator with the condition being defined within my component class like the following
@Component({
selector: 'foo',
templateUrl: './foo.component.html',
// Wouldn't probably say 'this' but still..
styleUrls: [this.condition ? './foo1.component.scss' : './foo2.component.scss']
})
export class FooComponent {
public condition = flase;
public changeCondition(condition: boolean): void {
this.condition = condition;
}
}
I have seen similar SO questions that solves the issue by defining the condition
variable outside the class, but this is not what I am looking for. I also went through other answers that uses the deprecated ComponentFactory which is also not what I'm looking for.
Is there any other way I can have such a thing?