[AngularJS] Store the entry url and redirect to entry url after Logged in
For example when a outside application need to visit your app address:
https://www.example.com/#/lobby/abc
But before enter '/lobby/abc', user need to login, so the application will redirect user to
https://www.example.com/#/login
Now what you want is after user logged in, you can redirect them to
https://www.example.com/#/lobby/abc
Instead of other pages like:
https://www.example.com/#/lobby
So to solve the problem, we need to do two things
1. Store the entry url
2. After logged in, redirect user to entry url
1. Store the entry ur:
angular.module('app')
// When can get pull url by using $location.absUrl()
// Because run block only run once for the module and app module is our main application module, so this should only store our entry url
// To reuse the entryUrl later, we store it in LoginService
.run(($location, LoginService) => LoginService.entryUrl = $location.absUrl())
2. After logged in, then we can redirect user to the entry url by doing:
$location.url(LoginService.entryUrl)
[AngularJS] Store the entry url and redirect to entry url after Logged in的更多相关文章
- django ajax报错解决:You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set.
Django版本号:1.11.15 django中ajax请求报错:You called this URL via POST, but the URL doesn't end in a slash a ...
- SharePoint 2010 Url Shortener --SharePoint 2010 短URL生成器
SharePoint 2010 Url Shortener --SharePoint 2010 短URL生成器 项目描写叙述 本项目加入了这种功能.在SP站点中能够生成短URLs. 这些URLs指向列 ...
- js 获取url中的参数 修改url 参数 移除url参数
js 获取url中的参数 修改url 参数 移除url参数 var jsUrlHelper = { getUrlParam : function(url, ref) { var str = " ...
- Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...
- IDEA报错: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'spring.datasource.url' in value "${spring.datasource.url}"
运行审核流模块: 在ActivitiServiceApplication模块日志报错: Error starting ApplicationContext. To display the auto-c ...
- UrlUtils工具类,Java URL工具类,Java URL链接工具类
UrlUtils工具类,Java URL工具类,Java URL链接工具类 >>>>>>>>>>>>>>>&g ...
- 获取URL的name值 getUrl(url,name) 传入url和key 得到key对应的value
<body> <script type="text/javascript"> var url = "http://192.168.1.82:802 ...
- URL Handle in Swift (一) -- URL 分解
更新时间: 2018-6-6 在程序开发过程之中, 我们总是希望模块化处理某一类相似的事情. 在 ezbuy 开发中, 我接触到了对于 URL 处理的优秀的代码, 学习.改进.记录下来.希望对你有所帮 ...
- 加密解密Url字符串,C#对Url进行处理,传递Url
string _QueryStringKey = "abcdefgh"; //URL传输参数加密Key /// 加密URL传输的字符串 public string E ...
随机推荐
- Sublime Text 2/3 输入法修复[Ubuntu(Debian)]
一直想找一个可以替代sublime的IDE主要还是hi因为没有好的方法解决中文输入的问题, 今天在网上找到一个非常不错的方法,亲自实验是可行的,就记录下来了,我的系统是ubuntu16.04 Subl ...
- hexo_config.yml配置内容
# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/ ...
- linux 11201(11203) ASM RAC 安装
注意:11G的RAC安装,如果升级,则会新建目录在放软件,原来的不删除,所以所需空间比较大. 1.安装系统,把所有的开发包全部安装上 关掉防火墙和SELinux yum -y install comp ...
- 【VBA研究】如何用Base64 编解码方法实现简单的加解密
Base64编码的思想是是采用64个基本的ASCII码字符对数据进行重新编码,将数据变成字符串实现文本传输.由于编码简单,所以很容易实现,代码也是现成的.利用这个编码规则可以实现简单的加解密.编解码方 ...
- jQuery 冒泡事件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- idea 常用操作
1.创建的maven项目,java文件不提示错误:有main方法但右击却找不到run选项的问题 1)首先要配置SDK--就是配置JDK 2)然后要按照提示信息导入某些maven相关的东西,就这个Eve ...
- 09CSS高级定位
CSS高级定位 定位方式——position position:static|absolute|relative static表示为静态定位,是默认设置. absolute表示绝对定位,与下位置属 ...
- Android首页轮播图直接拿来用
import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; import jav ...
- js 右键菜单
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- MySQL-----备份(转储)
备份: **备份数据表结构+数据** mysqldump -u root 要备份的数据库表名 > 要备份的数据的备份名(这里也可以指定路径) -p **备份数据表结构** mysqldump - ...