asp.net-mvc - 如何通过 mvc 操作在 Angular 函数后重定向

标签 asp.net-mvc angularjs

我想通过 mvc 操作在 Angular 函数中成功后重定向用户。这是我的 Controller :

   $scope.login = function () {
        debugger;
        authService.login($scope.loginData).then(function (response) {
            debugger;

            $modalInstance.close(true);
            $location.path('/Home');
        },
         function (err) {
             $scope.message = err.error_description;
             $modalInstance.dismiss();
         });
    };  

但它不起作用?

肮脏的方式是:

<p class="login-success" ng-if="cartable">


                    @Html.ActionLink("ورود به کارتابل", "Index", "Home", null, null)


                    </p>

最佳答案

如果你尝试普通的 javascript 方式会怎样?

window.location.href="yournewUrlHere";

关于asp.net-mvc - 如何通过 mvc 操作在 Angular 函数后重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29719281/

相关文章:

c# - 具有本地化数据的 ASP.NET MVC GET 表单

javascript - 使用 contenteditable 计算字符数

angularjs - spring 社交 facebook + api + angularjs(如何从 angular 调用 -> spring api -> 重定向到 facebook 登录)

javascript - `Object` 与 js 控制台中的 `extend`

asp.net-mvc - 如何注销当用户在未注销的情况下关闭 Web 应用程序

c# - 无法在 JQuery 中获取/绑定(bind)正确的实体 ID,始终从迭代中获取第一个项目 ID

c# - asp.net mvc 模型绑定(bind)不绑定(bind)集合

asp.net-mvc - 使用 MOQ 的单元测试 Controller 。如何模拟httpcontext

javascript - Div 框展开并重新定位其他 div 框

javascript - Angular UI-grid 过滤器标题单元格样式?