1

I want to be able to create an reuseable subtag:

<tag>
  <subtag id=subtag></subtag>
</tag>

Therefor I would like to use the observable pattern to communicate with the sub tag:

var self = this

subtag = riot.mount('#subtag')[0]

subtag.on('clicked', function(){
  console.log('subtag has been clicked)
})

The code does not work since was already mounted. If I place the subtag outside the tag, it does however work. How to catch an event using the sub tag notation?

Federico Elles
  • 4,659
  • 7
  • 27
  • 35

1 Answers1

0

Since riot.js v2.0.13 all named subtags are accessible using self.<id>, see for details: How do I access child elements within riot.js

Community
  • 1
  • 1
Federico Elles
  • 4,659
  • 7
  • 27
  • 35