Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/478.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 爱奥尼亚显示空白页,没有任何错误_Javascript_Angularjs_Ionic Framework - Fatal编程技术网

Javascript 爱奥尼亚显示空白页,没有任何错误

Javascript 爱奥尼亚显示空白页,没有任何错误,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我得到了爱奥尼亚的空白页。chrome调试器中未显示任何错误。当我检查调试器时,我在ion nav视图中没有看到任何东西,这意味着出于某种原因ui路由器无法工作。需要帮助找出错误 这是我的密码: index.html: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, m

我得到了爱奥尼亚的空白页。chrome调试器中未显示任何错误。当我检查调试器时,我在ion nav视图中没有看到任何东西,这意味着出于某种原因ui路由器无法工作。需要帮助找出错误

这是我的密码:

index.html:

 <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link rel="manifest" href="manifest.json">

    <!-- un-comment this code to enable service worker
    <script>
      if ('serviceWorker' in navigator) {
        navigator.serviceWorker.register('service-worker.js')
          .then(() => console.log('service worker installed'))
          .catch(err => console.log('Error', err));
      }
    </script>-->

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ionic/js/angular/angular-resource.min.js"></script>
    <script src="lib/ionic/js/angular-ui/angular-ui-router.min.js"></script>
    <script src="lib/ngCordova/dist/ng-cordova.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
    <script src="js/services.js"></script>
    <script src="js/controllers.js"></script>
  </head>

  <body ng-app="watchHoursApp">
    <ion-nav-view>
    </ion-nav-view>
  </body>
</html>

您需要在angular应用程序初始化中插入ui路由器模块


angular.module('watchHoursApp',['爱奥尼亚','ui.router'])

您需要在angular应用程序初始化中注入ui路由器模块


angular.module('watchHoursApp',['爱奥尼亚','ui.router'])

爱奥尼亚默认包括……这是我的第二个爱奥尼亚项目……有些东西缺失,很难弄清楚……现在浪费了将近1个小时。如果我将menu.html的内容直接放在index.html的ion nav视图中,内容会显示在页面上。,这意味着ui路由器仍然不工作。如果你加载
angular.js
framework fle,我没有看到。我只能看到角度资源和角度路由器。如果我错了,请纠正我。默认情况下,Angular是用ionic.bundle.js加载的,因此无需重新插入。尽管如此,我还是按照你说的做了,但没有ProgressION默认包括……这是我的第二个IONA项目……有些东西缺失,很难弄清楚……现在浪费了将近1个小时。如果我将menu.html的内容直接放在index.html的ion nav视图中,内容会显示在页面上。,这意味着ui路由器仍然不工作。如果你加载
angular.js
framework fle,我没有看到。我只能看到角度资源和角度路由器。如果我错了,请纠正我。默认情况下,Angular是用ionic.bundle.js加载的,因此无需重新插入。尽管如此,我还是照你说的做了,但没有任何进展
<ion-side-menus enable-menu-with-back-views="false">
  <ion-side-menu-content>
    <ion-nav-bar class="bar-stable">
      <ion-nav-back-button>
      </ion-nav-back-button>

      <ion-nav-buttons side="left">
        <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
        </button>
      </ion-nav-buttons>
    </ion-nav-bar>
    <ion-nav-view name="menuContent"></ion-nav-view>
  </ion-side-menu-content>

  <ion-side-menu side="left">
    <ion-header-bar class="bar-stable"  >
      <h1 class="title">watchHours</h1>
    </ion-header-bar>
    <ion-content>
      <ion-list>
        <ion-item menu-close ui-sref="app">
          HOME 
        </ion-item>
        <ion-item menu-close ng-if="currentUser" ui-sref="app.user({id: uid})">
          {{username}}
        </ion-item>
        <ion-item menu-close ui-sref="app.search">
          TV SHOWS
        </ion-item>
        <ion-item menu-close ng-if="!currentUser" ng-click="login()">
          Log in
        </ion-item>
        <ion-item menu-close ng-if="!currentUser" ng-click="register()">
          Sign up
        </ion-item>
        <ion-item menu-close ng-if="currentUser" ng-click="logout()">
          Log out
        </ion-item>
      </ion-list>
    </ion-content>
  </ion-side-menu>
</ion-side-menus>
// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('watchHoursApp', ['ionic'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('app', {
      url: '/app',
      abstract: true,
      templateUrl: 'templates/menu.html',
      controller: 'SidemenuCtrl'
  });
  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/app');
});
angular.module('watchHoursApp')

.controller('SidemenuCtrl', ['$scope', '$state', '$rootScope', 'Shows', '$http', 
  '$location', '$localStorage', 'HomeServices', 'AuthFactory',
  '$ionicModal', '$ionicSideMenuDelegate', '$timeout',
  function ($scope, $state, $rootScope, Shows, $http, 
    $location, $localStorage, HomeServices,
    AuthFactory, $ionicModal, $ionicSideMenuDelegate, $timeout) {
    console.log("Hello");
  // With the new view caching in Ionic, Controllers are only called
  // when they are recreated or on app start, instead of every page change.
  // To listen for when this page is active (for example, to refresh data),
  // listen for the $ionicView.enter event:
  //$scope.$on('$ionicView.enter', function(e) {
  //});

   // Form data for the login modal
    $scope.loginData = $localStorage.getObject('userinfo','{}');
    $scope.reservation = {};
    $scope.registration = {};
    $rootScope.currentUser = false;
    $rootScope.username = '';
    $rootScope.admin = false;
    $rootScope.uid = '';
    $rootScope.isVerified = false;

    if(AuthFactory.isAuthenticated()) {
      $rootScope.currentUser = true;
      $rootScope.username = AuthFactory.getUsername();
      $rootScope.admin = AuthFactory.isAdmin();
      $rootScope.isVerified = AuthFactory.isVerified();
      $rootScope.uid = AuthFactory.uid();
    }

    // Create the login modal that we will use later
    $ionicModal.fromTemplateUrl('templates/login.html', {
        scope: $scope
    }).then(function (modal) {
        $scope.modal = modal;
    });

    // Triggered in the login modal to close it
    $scope.closeLogin = function () {
        $scope.modal.hide();
    };

    // Open the login modal
    $scope.login = function () {
        $scope.modal.show();
    };

    // Perform the login action when the user submits the login form
    $scope.doLogin = function () {
        console.log('Doing login', $scope.loginData);
        $localStorage.storeObject('userinfo',$scope.loginData);
        AuthFactory.login($scope.loginData);
        $scope.closeLogin();
    };

    $scope.logout = function() {
        AuthFactory.logout();
        $rootScope.currentUser = false;
        $rootScope.username = '';
        $rootScope.admin = false;
        $rootScope.isVerified = false;
        $rootScope.uid = '';
        $state.go("app");
    };

    // On successful login
    $rootScope.$on('login:Successful', function () {
        $rootScope.currentUser = AuthFactory.isAuthenticated();
        $rootScope.username = AuthFactory.getUsername();
        $rootScope.admin = AuthFactory.isAdmin();
        $rootScope.uid = AuthFactory.uid();
        $rootScope.isVerified = AuthFactory.isVerified();
    });

    // Create the login modal that we will use later
    $ionicModal.fromTemplateUrl('templates/register.html', {
        scope: $scope
    }).then(function (modal) {
        $scope.registerform = modal;
    });

    // Triggered in the login modal to close it
    $scope.closeRegister = function () {
        $scope.registerform.hide();
    };

    // Open the login modal
    $scope.register = function() {
        $scope.registerform.show();
    };

    // Perform the login action when the user submits the login form
    $scope.doRegister = function() {
        console.log('Doing registration', $scope.registration);
        $scope.loginData.username = $scope.registration.username;
        $scope.loginData.password = $scope.registration.password;

        AuthFactory.register($scope.registration);
        // Simulate a login delay. Remove this and replace with your login
        // code if using a login system
        $timeout(function () {
            $scope.closeRegister();
        }, 1000);
    };

    // On successful registration
    $rootScope.$on('registration:Successful', function () {
        $rootScope.currentUser = AuthFactory.isAuthenticated();
        $rootScope.username = AuthFactory.getUsername();
        $rootScope.admin = AuthFactory.isAdmin();
        $rootScope.uid = AuthFactory.uid();
        $rootScope.isVerified = AuthFactory.isVerified();
    });

    $scope.toggleLeft = function() {
        $ionicSideMenuDelegate.toggleLeft();
      };
}]);