我有一个由requiredJs优化的模块。我想在我的路由器中加载该模块。我能够做到这一点,如果模块没有优化,但优化后,路由器不再工作。以下是优化模块的外观和路由器代码
优化模块:
define('fullpage/pages/participant/ParticipantJoin',[
'jquery',
'underscore',
'backbone',
'translator',
// Using the Require.js text! plugin, we are loaded raw text
// which will be used as our views primary template
'text!fullpage/pages/participant/templates/participantJoinTemplate.html',
], function($, _, Backbone, ParticipantInvitation, ParticipantInfo, Translator, template){
var ParticipantJoinView = Backbone.View.extend({
.... more code
路由器代码
var app_router = new AppRouter;
app_router.on('route:invite', function(inviteId){
require([
'pages/participant/ParticipantJoin'
], function(ParticipantJoinView) {
var participantJoin = new ParticipantJoinView({
inviteId: inviteId
});
});
});
错误是ParticipantJoinView为null。我不知道为什么没有加载该模块。如何装载它?
谢谢,