We undoubtedly use safe navigation in string interpolation ({{}}
) to safely navigate values in a nested object with checking nulls or undefined.
I have a question that, is it okay to use safe navigation also for:
ngIf
ngFor
ngModel
ngClass
[disabled]
, [style]
, etc.For which scenarios should I use and not?
We can use ? in every place you have mentioned, except two way binding ngModel. You could use when you are using [ngModel] but not when using [(ngModel)]