从主页重定向到登录页面时无法隐藏登录页面中的导航栏 [英] Unable to hide the navigation bar in login page when redirecting from home page to login page
问题描述
我正在尝试使用 Angular Material 和 Angular Flex Layout 在 Angular 中实现一个示例应用.
I am trying to implement a sample app in Angular using Angular Material and Angular Flex Layout.
我已经实现了一个隐藏在登录页面中并在应用程序的所有页面中可见的导航栏.
I have implemented a navigation bar which is hidden in login page and visible in all pages in the appllication.
我创建了一个名为 showmenu.service.ts 的服务,其中我声明了两个变量并将它们分配为布尔值..
I have created a service with the name showmenu.service.ts where I have declared two variable and assigned them as boolean..
我可以在启动应用程序时隐藏登录页面中的导航栏.但是当我登录到应用程序时,我在控制台中收到以下错误,如下所示.
I am able to hide the navigation bar in my login page as start my application. But as I login in to the application, I am getting the following error in my console as shown below.
我无法找出问题所在..而且当我尝试注销时,我再次在登录页面中看到导航栏,如下所示.
I am unable to find out the problem..And also when I am trying to logout I am again getting the Navigation bar in my login page as shown below.
有人能帮我解决这个问题吗....
can anybody help me out with this issue....?
推荐答案
如果 *ngIf
,请尝试使用 [hidden]
代替.几个月前我遇到了同样的问题,它解决了我.所以它应该可以解决您的错误.
Try to use [hidden]
instead if *ngIf
. I had this same problem some months ago and it resolved to me. So it should solve your error.
所以使用这个 [hidden]="showmenu.visible1"
而不是 *ngIf="showmenu.visible1"
So use this [hidden]="showmenu.visible1"
instead of *ngIf="showmenu.visible1"
并请检查 angular 2 - 如何隐藏某些组件中的导航栏如何使用服务显示/隐藏菜单并与您的代码进行比较...
And kindly check angular 2 - how to hide nav bar in some components how it is works for show/hide menus by using service and compare with your code...
这篇关于从主页重定向到登录页面时无法隐藏登录页面中的导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!