zoukankan      html  css  js  c++  java
  • 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?

  • 相关阅读:
    centos7源以及相关的一些命令
    创建Vue实例的三种方法
    github 钩子管理工具 overcommit
    npm管理registry 【转】
    两个字典增量部分
    celery (二) task调用
    shell编程
    linux 环境变量 转
    celery (二) task
    celery(一) application
  • 原文地址:https://www.cnblogs.com/xixifusigao/p/3954061.html
Copyright © 2011-2022 走看看