从首页重定向到登录页面时,无法在登录页面中隐藏导航栏 [英] Unable to hide the navigation bar in login page when redirecting from home page to login page

查看:76
本文介绍了从首页重定向到登录页面时,无法在登录页面中隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Angular Material Angular Flex布局 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 ,请尝试使用 [隐藏] .几个月前我也遇到了同样的问题,它解决了我.因此它应该可以解决您的错误.

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"

请检查角度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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆