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,445
  • 14
  • 73
  • 125

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
  • 558,509
  • 191
  • 1,911
  • 1,506