Rather than having five different routes, I am trying to combined five different paths into a single function, but I still need to know which path it matched. So if I set up my route using a regex:
Router.route(/^/(accounts)|(contacts)|(forecasts)|(analytics)|(activities)/, function() {
// which one did it match?
console.log("matched "+this.params) //this returns an array of five params
}
how do I refer to the matched parameter inside the function?
this.params returns an array of five params with four of them undefined and the other matching, but which one is defined depends on what matched so this isn't very helpful.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…