0

Why can’t structural directives (like *ngIf or *ngFor) be applied to the same element together?

author
subina kallyani
easy
0
9

Answer

Because each structural directive modifies the DOM layout by adding/removing templates. Angular enforces one structural directive per host element to avoid conflicts.

Why it’s useful: Interviewers like this as it tests directive internals, not just usage.

Click to Reveal Answer

Tap anywhere to see the solution

Revealed

Comments0
    Why can’t structural directives (like *ngIf or *ngFor) be applied to the same element together? - directives | EBAT