App.component.html
This error occurs when you try to define a template reference variable with the same name of an existing variable, like for example in this case:
@Component({
selector: 'example',
template: `
`
})
export class AppComponent {
name:string;
}
As you can see, there’s the template reference variable #name on the input and there’s also a variable called name on my class, this will cause the following error when you try to run the application:
zone.js:355 Unhandled Promise rejection: Cannot assign to a
reference or variable! ; Zone: ; Task: Promise.then ; Value:
Error: Cannot assign to a reference or variable!(…) Error: Cannot
assign to a reference or variable!
the solution is to change the name of one of your variables.