简体   繁体   English

AngularJS SPA登录页面

[英]AngularJS SPA Login Page

I have an Angularjs single page application and now I would like to add a login page to it. 我有一个Angularjs单页应用程序,现在我想向其中添加一个登录页面。 Here is my SPA template plunker : http://plnkr.co/edit/WgUDJQNL0YCKWUfXMFsr?p=preview . 这是我的SPA模板plunkerhttp : plunker I need a login page and not a modal(examples are available for login page as modal). 我需要一个登录页面,而不是模式页面(示例可用于模式登录页面)。 User has to view the information page(which is in above plunker) only after logging in. Have gone through various videos and tutorials on this but couldn't find a solution. 用户仅在登录后才可以查看信息页面(位于punker上方)。已经阅读了各种视频和教程,但是找不到解决方案。 As am new to angularjs, would be grateful if anyone can provide the code for this. 作为angularjs的新手,如果有人可以提供此代码,将不胜感激。

Thanx in advance!! 提前感谢!

Remove the body content from index and put it in a separate file(home.html). 从索引中删除正文内容,并将其放在单独的文件(home.html)中。 Just add a ui-view in the body. 只需在主体中添加ui视图即可。 In run block route to login page by default. 在运行块中,默认情况下会路由到登录页面。 On login success route to your home page using $state.go('home') . 登录成功后,使用$state.go('home')进入您的主页。 Name the tab routes as home.tab1 and home.tab2 for Nested routes. 将嵌套路由的选项卡路由命名为home.tab1和home.tab2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM