Where cleanly use jQuery outside a component?


#1

Hi,

I am currently building an addon for using ChardinJs with ember apps.
However, ChardinJs is a jQuery module.

So, my idea is to create components to scope areas for Chardin hints.

{{#chardin-hint
      hint="The famous ChardinJs button launcher."
      position="right"
}}
    <button {{ action "toggleChardin" }}>Show hints</button>
{{/chardin-hint}}

But… to toggle the Chardin overlay we need jQuery call.

$('body').chardinJs('start');

And I want to make Chardin callable from a controller or a service.

  • Should I use a service as adapter to jquery call or an utility class ?
  • Could I really use jquery outside a component ?

Thanks for advance.
Regards,


#2

I don’t know if this is the right way. But I made this today : Swizz/ember-chardin