Iron-router ReferenceError:未定义AppController

时间:2015-02-07 17:16:26

标签: meteor iron-router

我在我的Meteor应用程序中使用铁路由器,但每次我尝试向AppController添加新的子控制器时,都会出现以下错误。下面是我的应用程序中的路由器相关代码,有人可以告诉我这里缺少什么/做错了吗?感谢

 /Users/mkm/.meteor/packages/meteor-tool/.1.0.40.n80bjt++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:173
         throw(ex);
           ^
ReferenceError: AppController is not defined
    at app/both/controllers/aboutus.js:1:56
    at app/both/controllers/aboutus.js:5:3
    at /Users/mkm/meteor/projects/mshop/.meteor/local/build/programs/server/boot.js:205:10

我在我的应用中使用的代码:

AppController = RouteController.extend({
  layoutTemplate: 'appLayout'
});
HomeController = AppController.extend({

});
DashboardController = AppController.extend({

});
AboutUsController = AppController.extend({  

});


Router.configure({
  controller: 'AppController',
  loadingTemplate: 'loading'
});


Router.map(function() {

  this.route('home', {
     path: '/',
     template: 'home',
     controller: "HomeController"        
  });

  this.route('aboutus', {
     path: '/aboutus',
     template: 'aboutus',
     controller: "AboutUsController"    
  });

  this.route('dashboard', {
     path: '/dashboard',
     template: 'dashboard',
     controller: "DashboardController"     
  });

});

版本:

铁:router@1.0.7

Meteor 1.0.3.1

0 个答案:

没有答案