After enabling strictNullChecks
with Angular 4.1.1, getting several errors for null
checks. I have fixed bundles of them but unable to fix the same Object is possibly 'null'
for this.form.get('username').value
. Likewise others, I have tried the same but unable to fix the error.
if (this.form.get('username') != null) {
body.append('username', this.form.get('username').value);
}
Try using Non-null assertion operator like
this.form.get('username')!.value; // notice !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With