Pregunta

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 ?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top