1
if ($scope.IsFormValid) {
  return $http({
         url: '/User/UserLogin',
           method: 'POST',
          data: JSON.stringify($scope.User),
             headers: { 'content-type': 'application/json' }
       }).success(function (d) {

                        $location.path('/here'); //how to use redirection here after success

       })
       .error(function (data) {
         $scope.LoginErrorMessage = "There was a problem logging in: " ;
       });
}
4

2 回答 2

1
$window.location.href = '/here.html';

您可能还需要将 $window 注入您的控制器。

于 2015-10-29T17:44:49.850 回答
0

可以使用其中任何一种来实现。

$window.location.href = '/here.html'; (如上所述)

或者

$location.path("你的路径");

或者

$state.go("州名");

请记住,您必须在控制器中注入这些服务。

于 2015-10-29T18:00:58.813 回答