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. fabric的安装

    https://blog.csdn.net/lepton126/article/details/79148027

  2. eclipse如何设置多个字符的智能提示

    clipse代码里面的代码提示功能默认是关闭的,只有输入“.”的时候才会提示功能,用vs的用户可能不太习惯这种,vs是输入任何字母都会提示,下面说一下如何修改eclipse配置,开启代码自动提示功能打 ...

  3. Duplicate fragment name ERROR Jetty Maven Plugin

    http://stackoverflow.com/questions/5802096/duplicate-fragment-name-error-jetty-maven-plugin 4down vo ...

  4. 安装exe4j出现jre不匹配问题

    在安装exe4j 客户端,提示如下错误: 提示的错误信息大意如下:install4j安装时,在本系统中没有找到JRE(JavaRuntime Environment)(版本要求:最低1.5,最高1.6 ...

  5. Beam Search

    Q: 什么是Beam Search? 它在NLP中的什么场景里会⽤到? 传统的广度优先策略能够找到最优的路径,但是在搜索空间非常大的情况下,内存占用是指数级增长,很容易造成内存溢出,因此提出了beam ...

  6. scikit-learn - 分类模型的评估 (classification_report)

    使用说明 参数 sklearn.metrics.classification_report(y_true, y_pred, labels=None, target_names=None, sample ...

  7. BZOJ 4519 不同的最小割 最小割树

    题面: 把每两个点当成源汇,求N*(N-1)个最小割中不同的有多少个 N<=850 分析: 有这样一个结论:一张无向图不同的最小割最多有n-1个. 那么我们一定可以建出一棵树,使得这棵树中每两个 ...

  8. 远程连接mysql数据库

    远程连接mysql数据库需要以下步骤(改表法): 1.数据源(数据库服务器)对要访问数据库进行授权: 2.本地库(本地)连接: 具体方法: 1. 进入数据服务器,输入cmd进入控制台:输入 mysql ...

  9. IDEA打war包部署本地TOMCAT测试

    在Eclipse中打war包很方便,导出即可直接选择war包,如下图所示: 但是在IDEA中有点麻烦,网上很多教程,做的也都很好,我自己也做一份,加深一下印象. 首先打开File->Projec ...

  10. Kali Linux 下载、引导、安装

    下载卡莉 Linux 官方镜像: https://www.kali.org/downloads/ 官方虚拟机镜像: https://www.offensive-security.com/kali-li ...