Frage

I'm trying to setup a route as follows

Router.configure({
    layout: 'layout',
    loadingTemplate: 'loading',
    notFoundTemplate: 'notFound'
});

Router.map(function () {
    /*
    this.route('/', {
        controller: 'MyController',
        action: 'start'
    });
    */

    this.route('/:a/:b', {
        controller: 'MyController',
        action: 'start'
    });
});

The Controller looks like this

MyController = RouteController.extend({
    template: 'barfoo',

    before: function () {
        var a = this.params.a,
            b = this.params.b;

        ...
    },
    waitOn: function () { ... },
    data: {  ... },

    start: function () {
});

The issue is that the before function is never called. If I do something like

...
this.route('/', {
    controller: 'MyController',
    action: 'start'
});

the before function is called. I don't see any errors in the console. I must have missed something here, any suggestions ?

War es hilfreich?

Lösung

It would appear to me that the route is never actually triggered. You should check whether the first example actually triggers any code at all.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top