iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

Getting data for current route in onAfterAction #1569

Closed KaitaniLabs closed 7 years ago

KaitaniLabs commented 7 years ago

I'm really struggling to understand how to get the data context from the current route in an onAfterAction.

OnAfterActions = {
    setDoc: function () {
        let routeName = this.route.getName();
        switch(routeName){
            case "MapView":
                if (this.ready()) {
                    // 
                    // Need the data here
                    //
                }
            break;
            default:
                //
            break;
        }
        this.next();
    }
};

I've tried: .data, .data(), .getData() with this, Router, Router.current(), Router.route, this.route, nothing seems to return anything.

Any help would be very much appreciated.

chrisbutler commented 7 years ago

how are you adding the hook to the route?

it should just be this.data()