Hi, I’m wondering if there’s a way to add controller to the element? This would be cool because with Turbolinks, this controller won’t re-initialize or re-connect. This controller will persist for the entire Turbolinks session. For sites without Turbolinks, it would just behave as if you placed the controller anywhere else.
Yes, that’s supported. It’s the same as adding a controller any other element:
Keep in mind that Turbolinks may perform full page reloads if assets change during a session: https://github.com/turbolinks/turbolinks#reloading-when-assets-change
Oh wow, that’s perfect. Should this be documented somewhere or I just missed it. If it’s not documented, I’d be able to help out if you can point me to where the best place is?
I don’t think it needs documentation because it’s not special behavior.