Angular 2 动态页眉和页脚 [英] Angular 2 Dynamic Page Header and Footer

查看:42
本文介绍了Angular 2 动态页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的 app.component.html 中包含的内容

The following is what is included in my app.component.html

<代码><标题></标题><路由器插座></路由器插座><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>

只需在 truefalse 之间切换 isLogin 显示/隐藏组件

Just switching isLogin between true and false shows/hides the components

这篇关于Angular 2 动态页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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