Pete.Mertz
Pete.Mertz

Reputation: 1301

this.redirect and Router.go both error with 'has no method'

I'm using Meteor version 0.8.3, iron-router version 0.8.2, and I can't get any method of redirecting to work. I've tried both Router.go and this.redirect('somepath') and both end up with the error Object [object Object] has no method followed by either redirect or go. No idea what's going on here, relevant code below:

Router.map(function() {
    this.route('about');
    this.route('about2', {
        where: 'server',
        action: function() {
            this.redirect('about');
        }
    })
});

Upvotes: 1

Views: 606

Answers (1)

saimeunt
saimeunt

Reputation: 22696

Iron Router is mostly a client-side routing package at the moment so there's no such thing as server-side redirects, the redirect method is a client only utility which works by altering window.location.

Remove where:"server" from your route and it should work as expected.

Upvotes: 3

Related Questions