What is the best way to use two-way-binding (syntax-sugar) in Angular 2 with the safe navigation operator. I've tried the following.
<input [(ngModel)]="x?.y?.z">
But this is not supported.
Is there a way to use sth. like this?
What is the best way to use two-way-binding (syntax-sugar) in Angular 2 with the safe navigation operator. I've tried the following.
<input [(ngModel)]="x?.y?.z">
But this is not supported.
Is there a way to use sth. like this?
Angular doesn't support safe navigation operator in two-way bindings. Instead you can do this way:
<!-- <input [(ngModel)]="x?.y"> -->
<input [(ngModel)]="x && x.y">
(tested with Angular 9)