Best way to initialize jQuery plugin in Ember 1.13.0


#1

Hi, in Ember 1.13.0 views are deprecated but routable components aren’t out yet. In many cases in my app i’m using a routable views, in order initialize some jQuery plugins, related to the current route, using didInsertElement hook. I would like your opinion about how to handle this deprecation now. Rapping the didInsertElement hook element in a component you think it’s the only way to go for now? Thanks!


#2

Yep, you’ve got the basic idea.

View are out, but don’t forget that components are an extension of views. So for example if I had an accordion menu that needed some kind of jquery accordion menu plugin to be initialized, I would make a component for my accordion menu, and then use didInsertElement in there as you would with a view.

And as a bonus, now you can reuse this component elsewhere!


#3

Yep… eventually i walked down this road. Thanks @Chava