I am created nav bar separately in nav.component.html ,how to hide nav bar in some components like login.component.
nav.component.html
Add *ngIf='!showNav' in template
And in LoginComponent
showNav = true;
This will show nav rest of the all the pages , if you want to hide in any pages just put showNav = true;
in that component.
How it works :
First for it will check for showNav
variable but it will not be available , so it will return false for the other pages where we want to show menu , so need to declare that variable any other pages.
In login page we set the value to true, so it will make it false and hide the nav.