I know this question is asked and answered already here... Angular 2 Form Validation Error "Unhandled Promise rejection: Cannot assign to a reference or variable!"
But my site privs are too low to followup there so I'm posting this separately.
The following snippet is directly from the Angular documentation, on the Lifecycle Hooks page...
https://angular.io/guide/lifecycle-hooks
@Component({
selector: 'app-child-view',
template: '<input [(ngModel)]="hero">'
})
export class ChildViewComponent {
hero = 'Magneta';
}
But when I try this EXACT thing, I get the 'cannot assign to a reference or variable error'. It seems like Angular's documentation is saying something that actually cannot be done. According to the other thread here on stackoverflow regarding this error, the name of input variable 'hero' should be changed to avoid colliding with the hero field inside the component. But Angular's own documentation shows that this is how it should be done. Is the Angular doc wrong?