侧面菜单运行但路线文件没有显示

时间:2016-03-11 04:20:05

标签: javascript angularjs meteor ionic-framework sidebar

我正在尝试使用聊天事件和设置标签创建简单的侧边菜单。如果我从路由js文件中删除设置和事件块但它什么也没显示,它就会运行。 片段在下面,如果需要,这里是指向你的comp上运行的整个meteor文件夹的链接 - https://drive.google.com/folderview?id=0B2MX6dSPUGBMTnMtWVVqLVcwNDQ&usp=sharing

我一直在说错误:

  

=> Meteor服务器重启   开始你的应用程序应用程序运行于:http://localhost:3000/   错误阻止启动:使用pbastowski处理文件时:angular-babel(对于目标web.browser):   client / scripts / routes.js:20:4:Babel转换错误   您的应用程序有错误。等待文件更改。

routes.js和settings.html

angular
  .module('myapp')
  .config(config);
 
function config($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('tab', {
      url: '/tab',
      abstract: true,
      templateUrl: 'client/templates/tabs.html'
    })
    .state('tab.chats', {
      url: '/chats',
      views: {
        'tab-chats': {
          templateUrl: 'client/templates/chats.html'
        }
      }
    });
    .state('tab.events', {
      url: '/events',
      views: {
        'tab-events': {
          templateUrl: 'client/templates/events.html'
        }
      }
    });

    .state('tab.settings', {
      url: '/settings',
      views: {
        'tab-settings': {
          templateUrl: 'client/templates/settings.html'
        }
      }
    });


 
  //$urlRouterProvider.otherwise('tab/recents');
}
<!-- settings.html, events.html, chats.html are all pretty much the same -->

<ion-view view-title="Settings">
  <ion-content>
 
  </ion-content>
</ion-view>

menu.html

<ion-side-menus>

  <ion-side-menu-content>
    <ion-nav-bar class="bar-stable nav-title-slide-ios7">
      <ion-nav-back-button class="button-clear"><i class="icon ion-ios7-arrow-back"></i> Back</ion-nav-back-button>
    </ion-nav-bar>
    <ion-nav-view name="menuContent" animation="slide-left-right"></ion-nav-view>
  </ion-side-menu-content>

  <ion-side-menu side="left">
    <header class="bar bar-header bar-royal">
      <h1 class="title">Left</h1>
    </header>
    <ion-content class="has-header">
      <ion-list>
        <ion-item menu-close title="Chats" href="#/app/chats">
          Chats
        </ion-item>
        <ion-item menu-close title="Events" href="#/app/events">
          Events
        </ion-item>
        <ion-item menu-close title="Settings" href="#/app/settings">
          Settings
        </ion-item>
      </ion-list>
    </ion-content>
  </ion-side-menu>

</ion-side-menus>

1 个答案:

答案 0 :(得分:0)

看起来你在那里不应该有一些分号。对state的调用必须是嵌套的,所以不要用分号结束它们,除非它是你的最后一个。更新的代码:

angular
  .module('myapp')
  .config(config);

function config($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('tab', {
      url: '/tab',
      abstract: true,
      templateUrl: 'client/templates/tabs.html'
    })
    .state('tab.chats', {
      url: '/chats',
      views: {
        'tab-chats': {
          templateUrl: 'client/templates/chats.html'
        }
      }
    })
    .state('tab.events', {
      url: '/events',
      views: {
        'tab-events': {
          templateUrl: 'client/templates/events.html'
        }
      }
    })

    .state('tab.settings', {
      url: '/settings',
      views: {
        'tab-settings': {
          templateUrl: 'client/templates/settings.html'
        }
      }
    });



  //$urlRouterProvider.otherwise('tab/recents');
}