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

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -