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的更多相关文章

  1. 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 ...

  2. SharePoint 2010 Url Shortener --SharePoint 2010 短URL生成器

    SharePoint 2010 Url Shortener --SharePoint 2010 短URL生成器 项目描写叙述 本项目加入了这种功能.在SP站点中能够生成短URLs. 这些URLs指向列 ...

  3. js 获取url中的参数 修改url 参数 移除url参数

    js 获取url中的参数 修改url 参数 移除url参数 var jsUrlHelper = { getUrlParam : function(url, ref) { var str = " ...

  4. 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 ...

  5. 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 ...

  6. UrlUtils工具类,Java URL工具类,Java URL链接工具类

    UrlUtils工具类,Java URL工具类,Java URL链接工具类 >>>>>>>>>>>>>>>&g ...

  7. 获取URL的name值 getUrl(url,name) 传入url和key 得到key对应的value

    <body> <script type="text/javascript"> var url = "http://192.168.1.82:802 ...

  8. URL Handle in Swift (一) -- URL 分解

    更新时间: 2018-6-6 在程序开发过程之中, 我们总是希望模块化处理某一类相似的事情. 在 ezbuy 开发中, 我接触到了对于 URL 处理的优秀的代码, 学习.改进.记录下来.希望对你有所帮 ...

  9. 加密解密Url字符串,C#对Url进行处理,传递Url

    string _QueryStringKey = "abcdefgh"; //URL传输参数加密Key /// 加密URL传输的字符串        public string E ...

随机推荐

  1. Win7 32位 遇到微软 silverlight 5.0安装失败的解决办法

    刚开始,也是尝试下载安装,多次都是到99%,提示安装失败! 也查找了很多网上朋友分享的办法,还是不行.重新建立一个管理员账号,还是不行. 后来反复不断的测试,找到原因了,安装99%不成功,但是卸载程序 ...

  2. Java Web数据库篇之MySQL特性

    MySQL ExplainEXPLAIN 命令的输出内容大致如下: mysql> explain select * from user_info where id = 2\G********** ...

  3. Bzoj4899 记忆的轮廓

    B. 记忆的轮廓 题目描述 通往贤者之塔的路上,有许多的危机.我们可以把这个地形看做是一颗树,根节点编号为1,目标节点编号为n,其中1-n的简单路径上,编号依次递增,在[1,n]中,一共有n个节点.我 ...

  4. Hadoop环境搭建、启动和管理界面查看

    一.hadoop环境搭建: 1. hadoop 6个核心配置文件的作用:core-site.xml:核心配置文件,主要定义了我们文件访问的格式 hdfs://hadoop-env.sh:主要配置我们的 ...

  5. 如何用SQL语句在指定字段前面插入新的字段?

    如何用SQL语句在指定字段前面插入新的字段? 2007-10-17 09:28:00|  分类: 笔记|举报|字号 订阅     create proc addcolumn @tablename va ...

  6. scrollfix.js插件:滚动固定在某个位置

    插件文件在/文件 scrollfix.js 用法: var fix = $(".fix"), fixtop = $(".fix-top"), fixStartT ...

  7. 「 Luogu P3137 」X 「 USACO16FEB 」 圆形谷仓

    # 题目大意 管理大大给修下 $\text{Markdown}$ 吧,严重影响做题体验啊. 这道题的意思很简单就是给你一个长度是 $n$ 的环,这个环上不均匀的分布着 $n$ 头奶牛.一头奶牛移动要花 ...

  8. mybatis保存时将数据库自动生成的主键返回

    场景 保存订单数据和订单详情数据时需要将订单的主键作为关联子段添加到明细表中,需要将保存订单时的主键返回给供保存明细表时使用 添加xml中新增数据时的配置 <insert id="in ...

  9. 安装php扩展(以swoole)为例

    一.下载swoole到/usr/local/src目录下,操作 git clone https://gitee.com/swoole/swoole.git; 二.cd swoole,phpize(如果 ...

  10. leetcode-88合并两个有序数组

    合并两个有序数组 思路:利用索引合并两个列表,排序.注意不需要返回值,只修改nums1 class Solution: def merge(self, nums1: List[int], m: int ...