我正在开始一个离子项目,但它只提供白屏。显示没有错误

时间:2016-11-09 07:48:35

标签: javascript ionic-framework

我正在开始一个离子项目。它对我不起作用。我正在为所有视图做侧边菜单。我想在离子导航视图中快速重放.in索引页面我可以填写它也显示的内容作为输出。但我想在menulayout.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">




    <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>

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

    <!-- your app's js -->
    <script src="app/app.js"></script>
  </head>
  <body ng-app="starter">

    <ion-pane>
      <ion-nav-view>

      </ion-nav-view>
    </ion-pane>
  </body>
</html>

app.js

angular
    .module('starter', ['ionic'])
    .run([ '$ionicPlatform', function($ionicPlatform) {


        $ionicPlatform.ready(function() {

            if(window.cordova && window.cordova.plugins.Keyboard) {

                if (cordova.plugins.Keyboard.hideKeyboardAccessoryBar) {
                  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
                }


                cordova.plugins.Keyboard.disableScroll(true);
            }
            if(window.StatusBar) {
      StatusBar.styleDefault();
    }

          });
    }])
    .config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
        $ionicConfigProvider.backButton.previousTitleText(false).text('');

        $stateProvider

        .state('app',{
          abstract:true,
          url: "/app",
          templateUrl:"app/layout/menulayout.html"
        })
        .state('app.home', {
          url: "/home",
          views:{
              'mainContent':{
              templateUrl: 'app/ast/home.html'
              }
          } 
        })
        .state('app.login', {
          url: "/login",
          views:{
              'mainContent':{
              templateUrl: 'app/ast/login.html'
              }
          } 
        });
        $urlRouterProvider.otherwise('/home');
});

menulayout.html

<ion-side-menus>

    <ion-pane ion-side-menu-content>
    <ion-nav-bar class="bar-dark" align-title='center'>
   <ion-nav-title align-title='center'>Home</ion-nav-title>

   <ion-nav-back-button class="button-icon button-clear">
    <i class="ion-arrow-left-c energized"></i>
  </ion-nav-back-button>

   <ion-nav-buttons side="left">
            <button menu-toggle="left" class="button button-icon button-clear ion-navicon">
            </button>
  </ion-nav-buttons>

</ion-nav-bar>
<ion-nav-view name="mainContent"></ion-nav-view>

        </ion-pane>

        <ion-side-menu side="left">

<header class="bar bar-header bar-dark">
    <h1>Home</h1>
</header>
<ion-content class="has-header highlight sidemenu">
    <ion-list>

                <ion-item nav-clear menu-close ui-sref="app.home"> 
                    Home
                </ion-item>

            </ion-list>

        </ion-side-menu>

        </ion-side-menus>

ionic serve显示白屏也没有错误显示在控制台中。

1 个答案:

答案 0 :(得分:0)

问题可能是grunt-concurrent@1.0.1的常见问题。尝试安装1.0.0版本,即:

npm install -g grunt-concurrent@1.0.0

确保您同时更新package.json文件