crisward / riot-routehandler

An angular-ui style minimalist route handler for riot.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Context

MahmoudFawzy opened this issue · comments

this my router sample
`
{
route: "/consultation/item/:id",
tag: "consultation-item",
use: function (ctx, next, page) {

                $.ajaxsys({
                    url: "/api/consultations/get/",
                    data: {
                        obj: JSON.stringify({
                            id: ctx.params.id
                        })
                    },
                    success: function (data) {
                        ctx.user = data;
                        next();
                    }
                })

            } 
        }

`

Page Js provide context , ctx , I think you must provide this ctx on opts of current component tag: "consultation-item" so I can use my callback data . I try to update your code but I'm not good on type script.

I fix by update "mountRoutes"
I add routeopts.state = req.state; after "routeopts.params = req.params;" line 40
now I has opts.state contain my opts.state.user

I'll close this as it sound like you may have answered your own question.