Warum braucht Route of Backbone die Standardroute?

Ich erstelle einen Testfall mit backbone.js @:http://jsfiddle.net/VWBvs/5/

Route ist definiert als

<code>var AppRouter = Backbone.Router.extend({
        routes: {
            "/posts/:id" : "getPost",
            "/download/*path": "downloadFile",  
            "*actions" : "defaultRoute"
        },
        getPost: function(id) {
            alert(id);
        },
        defaultRoute : function(actions){
            alert(actions);
        },
        downloadFile: function( path ){ 
            alert(path); // user/images/hey.gif 
        },
        loadView: function( route, action ){ 
            alert(route + "_" + action); // dashboard_graph 
        }
    });

    var app_router = new AppRouter;

    Backbone.history.start();​
</code>

Wenn ich die Funktion ändere

<code>  defaultRoute : function(actions){
            alert(actions);
        },
</code>

zu

<code>defaultRoute : function(actions){
            var action = actions
        },
</code>

Alle anderen Routen funktionieren nicht, dh es wird kein Dialogfeld angezeigt.

Aber wenn der Code geändert wird, ist alles in Ordnung.

Es ist wirklich komisch und verwirrt mich. SOS mit freundlichen Grüßen ......

Antworten auf die Frage(1)

Ihre Antwort auf die Frage