登录完成后无法正确重定向

cant redirect correctly after login is done

我正在尝试像这里的例子一样做登录页面: https://github.com/keithdmoore/ionic-http-auth 我有 2 个问题:

1.getting 尝试重定向到应用页面时出错

Error: Cannot transition to abstract state 'app'

代码:

  .controller('LoginCtrl', function ($scope, $state, AuthenticationService) {
    $scope.message = "";

    $scope.user = {
        username: null,
        password: null
    };

    $scope.login = function () {
        AuthenticationService.login($scope.user);
    };

    $scope.$on('event:auth-loginRequired', function (e, rejection) {
        console.log('handling login required');
        $scope.loginModal.show();
    });

    $scope.$on('event:auth-loginConfirmed', function () {
        $scope.username = null;
        $scope.password = null;
      $state.go('app');
    });

应用程序:

       .state('app', {
        url: "/app",
        abstract: true,
        templateUrl: "templates/menu.html",
        controller: 'AppCtrl'
    })
    .state('app.placeslists', {
        url: "/placeslists",
        cache: false,
        views: {
            'menuContent': {
                templateUrl: "templates/placeslists.html",
                controller: 'PlaceslistsCtrl'
            }
        }
    })

2.the 第二个问题看起来像 gui 的一些问题,我试图获取登录模板的列表示例,但它看起来不像离子组件的示例。 我的模板

<ion-view>
  <ion-content>
<div class="list"  ng-controller="LoginCtrl">
    <label class="item item-input">
        <input type="text" placeholder="Username" ng-model="user.username" required>
    </label>
    <label class="item item-input">
        <input type="password" placeholder="Password" ng-model="user.password" required>
    </label>
</div>
</ion-content> 
</ion-view>

关于问题 1,我在 github 上看到以下 $scope.loginModal.hide(); 而不是你的代码:$state.go('app');

关于第2期,请看ionic components<ion-nav-view> , <ion-content> , <ion-list> , <ion-item>

只需导航到主页或其他内容,因此:

.state('app.home', {
        url: "/home",
        cache: false,
        views: {
            'menuContent': {
                templateUrl: "templates/home.html"
            }
        }
    })

$scope.$on('event:auth-loginConfirmed', function () {
        $scope.username = null;
        $scope.password = null;
        $state.go('app.home');
    });