Redirect using AngularJS

后端 未结 6 1334
情书的邮戳
情书的邮戳 2020-11-30 02:28

I\'m trying to redirect to another route using:

$location.path(\"/route\");

But for some reason it is not working. I did an auto-complete w

6条回答
  •  死守一世寂寞
    2020-11-30 02:53

    Check your routing method:

    if your routing state is like this

     .state('app.register', {
        url: '/register',
        views: {
          'menuContent': {
            templateUrl: 'templates/register.html',
          }
        }
      }) 
    

    then you should use

    $location.path("/app/register");
    

提交回复
热议问题