0

Suppose you have *ngIf and *ngFor directives on one element. It makes much difference about the order directives are executed.

One way it will execute *ngFor one thousand times and check *ngIf for each iteration.

Another one will be checking *ngIf once and do nothing in case false result.

Not being able to use both directives on one element yields to non-essential markup getting into my code?

Why does angular doesn't define the order directives should be executed? It seems stupid!

Lu4
  • 14,873
  • 15
  • 79
  • 132

1 Answers1

1

Suppose you have *ngIf and *ngFor directives on one element

that's not supported. For more details see *ngIf and *ngFor on same element causing error

At least for this case there is no requirement to specify an execution order.

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567