Angular 2动态页面页眉和页脚 [英] Angular 2 Dynamic Page Header and Footer
本文介绍了Angular 2动态页面页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是我的app.component.html
The following is what is included in my app.component.html
<lmenu></lmenu>
<header></header>
<router-outlet></router-outlet>
<footer></footer>
<lmenu></lmenu>
<header></header>
<router-outlet></router-outlet>
<footer></footer>
但是,我的登录页面和注册页面都是通过此模块呈现的,它们仅需要路由器插座.如何动态地不包括用于登录和注册视图的lmenu,页眉和页脚选择器?预先感谢.
However my login and register pages are both rendered through this module and they only require the router-outlet. How an dynamically not include the lmenu, header, and footer selectors for the login and register views? Thanks in advance.
推荐答案
<lmenu *ngIf="isLogin"></lmenu>
<header *ngIf="isLogin"></header>
<router-outlet></router-outlet>
<footer *ngIf="isLogin"></footer>
只需在true
和false
之间切换isLogin
即可显示/隐藏组件
Just switching isLogin
between true
and false
shows/hides the components
这篇关于Angular 2动态页面页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文