How to switch layouts in Angular2

后端 未结 4 557
野性不改
野性不改 2020-11-27 13:22

What is the best practices way of using two entirely different layouts in the same Angular2 application? For example in my /login route I want to have a very simple box hori

4条回答
  •  情歌与酒
    2020-11-27 13:41

    Another simple way is define children routes:

    const appRoutes: Routes = [
      {
        path: 'fullLayout',
        component: FullLayoutComponent,
        children: [
          { path: 'view', component: HomeComponent },
        ]
      }, {
        path: 'simpleLayout',
        component: SimpleLayoutComponent,
        children: [
          { path: 'view', component: HomeComponent },
        ]
      }
    ];
    

    /fullLayout/view - shows full layout structure

    /simpleLayout/view - shows simple layout structure

    app.component.html

    
    

    full-layout.component.html

    Full layout

    FOOTER

    simple-layout.component.html

    Simple layout

提交回复
热议问题