core.js:6210 ERROR TypeError: Cannot read property 'nativeElement' of undefined code example
Example: core.js:5967 ERROR TypeError: Cannot read property 'nativeElement' of undefined
If you're using *ngIf to show or hide something, use [hidden] instead.
This should solve it for that particular scenario.