Angular 4:带侧栏概念的母版页

时间:2017-06-08 18:44:51

标签: html css angular master-pages

我正在使用Angular 4,我想为所有页面创建一个母版页概念。

这就是我想要的:

enter image description here

事实上,我想拥有一个带有自己模板的身份验证页面(如我的屏幕),以及其他具有不同模板的页面。

例如,我想要一个固定工具栏和一个左侧边栏。在内页中,有一个动态内容

在我的想法中,AppComponent页面中的路由器插座将显示Authentication页面或“Master Page”(工具栏和侧边栏)然后,在这个Master Page中,我为我的动态内容。

但它不起作用......

我该怎么做?

由于

1 个答案:

答案 0 :(得分:1)

如果您使用的是angular4,请使用components

你可以制作这些组件:

Authentification
Authentification-Content
Authentification-Sidebar
Master
Master-Titlebar
Master-Sidebar
Master-Content
Home
Product

然后,只需将组件注入彼此即可获得所需的结果。

例如,如果您想要显示“产品”页面,则必须按照以下方式注入您的组件:

index.html
    Master
        Master-Titlebar
        Master-Sidebar
        Master-content
            Product