Angular 6 for Enterprise:Ready Web Applications
上QQ阅读APP看书,第一时间看更新

Null guarding in Angular

In JavaScript, the undefined and null values are a persistent issue that must be proactively dealt with every step of the way. There are multiple ways to guard against null values in Angular:

  1. Property Initialization
  2. Safe Navigation Operator ?.
  3. Null Guarding with *ngIf