One difference between AngularJS' $location and window.location
Recenently, I encountered a problem.
Client side code is:
$http({
url: "/api/runtimelicense"
, method: "GET"
})
.success(function (data) {
window.location('#/search');
})
.error(function () {
});
Server side code is:
DbContext_context = GetContext(); // Just get dbcontexnt.
_context.MyDBSet.Where(s => s.ID == myID).ToList(); // When this request is from IE,it always throw exception with message "The connection was not closed. The connection's current state is open."; but if this request is from Chrome, all are ok.
At beginning, I felt very strange, as I know, browser should not impact server side by the same http request. I open Fiddler to see, there is an AngularJs digest error in IE, this error causes another request, it means there are two same http request to submit. I googled this question, but got nothing. I just repalce "window.location('#/search');" with "$location.path('/search');" , this issue is solved. Now, I still cannot know the details clearly. So, remain 2 questions:
1) Why does IE Angular digest exception?
2) Why does exception can cause another request?
One difference between AngularJS' $location and window.location的更多相关文章
- window.location.href = window.location.href 跳转无反应 a 超链接 onclick 点击跳转无反应
错误写法 , 主要是在 href="#"这里 <a href="#" id="send" onclick="return b ...
- window.location.href = window.location.href window.location.reload()
w 0-会议预订提交了预订日期,预订成功后默认显示仅显示当前日期的新页面若显示预定日的信息,则可以对预定日存入cookie: http://stackoverflow.com/questions/24 ...
- window.location和window.location.href和document.location的关系
1,首先来区分window.location和window.location.href. window.location.href是一个字符串. 而window.location是一个对象,包含属性有 ...
- JS中 window.location 与window.location.href的区别
疑惑:window.location='url' 与window.lcoation.href='url'效果一样,都会跳转到新页面,区别在哪?查得的资料如下: 1:window.location是页 ...
- js 刷新页面window.location.reload();
Javascript刷新页面的几种方法:1 history.go(0)2 window.location.reload() window.location.reload(true) 3 ...
- window.top.location.href 和 window.location.href 的区别
"window.location.href"."location.href"是本页面跳转. "parent.location.href" 是 ...
- window.location事件
一.最外层top跳转页面,适合用于iframe框架集 top.window.location.href("${pageContext.request.contextPath}/Login_g ...
- 解决微信浏览器无法使用window.location.reload()刷新页面
解决方法: 使用 window.location.href=window.location.href+随机数 代替 window.location.reload(). function r ...
- javascript宿主对象之window.location
location属性是一个用来存储当前页面URL信息的对象. 下面我们通过循环来列出location对象的完整属性列表: for(var i in location){ if(typeof locat ...
随机推荐
- 实现一套山寨springMVC
重复造轮子没有意义,但是通过现已存在的轮子,模仿着思路去实现一套,还是比较cool的.花了三天,终于深夜搞定!收益都在代码里,我干了,您随意! 一.简单思路 简单介绍: 1.所有的请求交给TyDisp ...
- 机器学习P7
优化问题: https://www.cnblogs.com/liaohuiqiang/p/7805954.html KKT条件就是把高数里面求不等式约束条件问题的分类方法写成两个条件.
- 为什么行内元素不能设置margin-top/margin-bottom/padding-top/padding-bottom?
HTML 里的元素分为替换元素(replaced element)和非替换元素(non-replaced element).- 替换元素是指用作为其他内容占位符的一个元素.最典型的就是img,它只是指 ...
- 如何在jsp和html页面上获取当前时间
要想在JSP页面中获得当前时间并显示出来,首先得导入相关的Java包,然后创建Date对象. <%@page import="java.text.SimpleDateFormat,ja ...
- C#-ado.net学习笔记-会有更新
ado.net 通用类对象.在本地内存暂存数据 托管类对象.让本地通用类对象连接数据库,让本地通用类对象和数据库同步 连接数据库 new connection(connectstring) comma ...
- (转)使用 vs.php 调试PHP
转自:http://www.jb51.net/article/24618.htm 早先在asp横行的年代,php和asp一样,大都都是html中夹杂代码,说实话,这时候IDE的确用处不是很大,倒是 ...
- hdu 1443 Joseph【约瑟夫环】
题目 题意:一共有2k个人,分别为k个好人和k个坏人,现在我们需要每隔m个人把坏人挑出来,但是条件是最后一个坏人挑出来前不能有好人被挑出来..问最小的m是多少 约瑟夫环问题,通常解决这类问题时我们把编 ...
- shell工具-awk
awk 一个强大的文本分析工具,把文件逐行的读入,以空格为默认分隔符将每行切片,切开的部分再进行分析处理. 基本用法 awk [选项参数] 'pattern1{action} pattern2{act ...
- toast js
参考别人的,自己改写了下,很好用. <!DOCTYPE html> <html lang="zh-CN"> <head> <meta ch ...
- CI
做项目时,经常会碰到需要使用php的情况,自己也下决心把php好好学一下. 先从CI开始,再看一下项目中的php代码是如何写的.