0

I have this custom structural directive, <div *someDirective> which shows div, if some condition is satisfied.

Now, I need to do conditional styling:
<div [ngClass]="SelectedProductId !== 0 && *someDirective ? 'w-23' : 'w-30'"

but this obviously throws errors.

It seems like impossible. So my question is, is this possible somehow to achieve at all?

Dacili
  • 258
  • 4
  • 8

1 Answers1

0

I think it's not possible. The first approach coming into my mind is to keep the business logic into an injectable service. Then, the existing directive will inject and use it. For the conditional class I would create a pipe instead which - as the directive - uses the created service.