2
下面是什么都包含在我app.component.html角2动态页面的页眉和页脚
<lmenu></lmenu> <header></header> <router-outlet></router-outlet> <footer></footer>
但是我的登录和注册页面都通过该模块提供,而且他们只需要路由器-出口。如何动态地不包括登录和注册视图的lmenu,页眉和页脚选择器?提前致谢。
下面是什么都包含在我app.component.html角2动态页面的页眉和页脚
<lmenu></lmenu> <header></header> <router-outlet></router-outlet> <footer></footer>
但是我的登录和注册页面都通过该模块提供,而且他们只需要路由器-出口。如何动态地不包括登录和注册视图的lmenu,页眉和页脚选择器?提前致谢。
<lmenu *ngIf="isLogin"></lmenu>
<header *ngIf="isLogin"></header>
<router-outlet></router-outlet>
<footer *ngIf="isLogin"></footer>
只需切换显示isLogin
和false
之间true
/隐藏组件
you could use two times in the terminal:
- ng generate component header
- ng generate component footer
then, in the main app file HTML (app.component.html) you must include the 2 tags:
<app-header></app-header>
<app-footer></app-footer>
this is the first thing to do.
Then you must populate your templates:
- header.component.html and the styling in header.component.css
- footer.component.html and the styling in footer.component.css
我明白了....对不起新角结构的指令是什么我失踪了,谢谢! https://angular.io/docs/ts/latest/guide/structural-directives.html –