javascript - How can I use parameter I get through riot.route()? -


riot.route('/*', function(category) {     riot.mount('#main', 'category-page', category) }) 

when url change, want parameter "category" , use in <category-page>. tried console.log(this.opts.category)in <category-page>, got undefined.

riot.route('/*', function(category) {     riot.mount('#main', 'category-page', category)     console.log(category) }) 

when code above, console.log(category) works well. think wrong passing or getting parameter. tried many case couldn't resolve it. please me problem.

according riot.js router api documentation when calling riot.mount(selector, tagname, [opts]) should pass object set this.opts in tag.

so router code should this:

riot.route('/*', function(category) {     riot.mount('#main', 'category-page', {category: category}) }); 

Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -