Backbone.js n'est pas un constructeur d'erreur lors de la création de l'instance de view

Je suis un nouvel utilisateur de backbone.js et les tests, comment pourrais-je travailler avec elle, les derniers jours j'ai été le tester comment pourrais-je utiliser de l'itinéraire pour modifier l'affichage des données via une collection.

Dans la situation actuelle, j'ai été coincé avec un problème que lorsque je suis en train de créer une instance de ScheduleView dans le router.js le journal de la console ce message d'erreur:

TypeError: ScheduleView is not a constructor

Code ci-dessous des trois pages de l'annexe du module {voir, collection, modèle} + l'router.js

Le routeur

//Filename: router.js
define([
    'jquery',    
    'underscore',
    'backbone',
    'app/views/schedule',
    'app/collections/schedule'
], function($, _, Backbone, ScheduleView, ScheduleCollection) {
    var AppRouter = Backbone.Router.extend({
        routes: {
            //Define some URL routes
            'schedule': 'scheduleRoute',
            //Default
            '*actions': 'defaultRoute'
        },
        scheduleRoute: function() {
            //Create a new instance of the collection
            //You need to set the url in the collection as well to hit the server
            var schedulecollection = new ScheduleCollection();
            //Pass in the collection as the view expects it
            console.log(typeof(ScheduleView));
            var scheduleview = new ScheduleView({
                collection: schedulecollection
            });            
           //No need of calling render here
           //as the render is hooked up to the reset event on collection          
        },
        defaultRoute: function(actions) {            
            //We have no matching route, lets display the home page
            //DashboardView.render();
        }
    });

    var initialize = function() {                
        var app_router = new AppRouter;
        Backbone.history.start();
    };
    return {
        initialize: initialize
    };
});

La Vue

//Filename: views/schedule
define([
    'jquery',
    'underscore',
    'backbone',
    'app/collections/schedule',
    'text!templates/schedule.html'
], function ($, _, Backbone, ScheduleCollection, ScheduleTemplate) {

    var scheduleView = Backbone.View.extend({        
        el: $(".app"),
        initialize: function () {
            //Listen to the reset event which would call render
            this.listenTo(this.collection, 'reset', this.render);
            //Fetch the collection that will populate the collection
            //with the response 
            this.collection.fetch();
        },
        render: function () {
            //console.log('schedule view loaded successfully');  
            console.log(this.collection);
        }
    });        
});

La collection

//Filename: collections/schedule
define([
    'jquery',
    'underscore',
    'backbone',
    'app/models/schedule'
], function ($, _, Backbone, ScheduleModel) {
    var ScheduleCollection = Backbone.Collection.extend({
        model: ScheduleModel,
        url: "http://sam-client:8888/sam-client/i/schedule",
        initialize: function () {
            //console.log('schedule collections loaded successfully');
        }
    });
    return ScheduleCollection;
});

Le Modèle

//Filename: models/schedule
define([
    'underscore',
    'backbone',
    'app/config'], function (_, Backbone, Config) {
    var ScheduleModel = Backbone.Model.extend({
        //If you have any
        //idAttribute : 'someId'
        //You can leave this as is if you set the idAttribute
        //which would be apprnded directly to the url
        urlRoot: "http://sam-client:8888/sam-client/i/schedule",
        defaults: {
            feedback: 'N/A'
        },
        initialize: function () {
            console.log('schedule model loaded successfully');
        }
    });
    return ScheduleModel;

});
Alors, que faut-il console.log?

OriginalL'auteur ahmedsaber111 | 2013-08-25