ERROR TypeError: Cannot read property 'nativeElement' of undefined angular 5 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.