对登录页面使用不同的页面布局 [英] Using different page layout for login page

查看:43
本文介绍了对登录页面使用不同的页面布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AngularJS实现SPA.我有一个主页布局,左侧处理导航链接,右上角也包含用户名和用户首选项,当然,大多数页面处理每个导航路径的内容.

I'm trying to implement a SPA with AngularJS. I have a main page layout where the left side deals with navigation links and the top right corner contains username and user preference options as well and of course most of the page deals with the content of each navigation path.

我要做的是,如果用户未登录,请将其重定向到布局完全不同的登录页面(登录表单居中,仅此而已).

What I'm trying to do is if the user is not logged in, redirect him to a login page that has a completely different layout (the login form centered and that's all).

如何以简单的方式完成此操作?

How can this be done in a simple manner?

推荐答案

我也正在实现此功能.我将把登录名和经过身份验证的应用程序视为两个不同的SPA.因此,将有2种不同的服务器路由,一种用于登录,另一种用于应用程序.

I am also in the process of implementing this feature. I will be treating login and the authenticated application as two different SPAs. So there will be 2 different server routes one for the login and one for the application.

这将使我不必在body标签上显示ng-view,因此无需在每条路径上都复制标题和侧边栏逻辑.

This will allow me to not have my ng-view on the body tag so I don't need to have my header and sidebar logic replicated on every route.

这篇关于对登录页面使用不同的页面布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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