Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute jQuery plugins that doesn't load with Ember?

I have a jQuery plugin from foundation (orbit).

Initially in my app.js I executed this:

$(document).foundation();

However with ember and dynamically loading views if I view the page that is supposed to work on it doesn't work. If I load up the console and manually hit it, it works. So how do I define this to be hit when a page is viewed "the ember way?"

like image 792
Ecl1pse Armageddon Avatar asked Mar 23 '23 07:03

Ecl1pse Armageddon


2 Answers

I usually use the didInsertElement function on the view to set up my Jquery plugins.

ref : http://emberjs.com/api/classes/Ember.View.html#event_didInsertElement

like image 119
Arnaud Gourlay Avatar answered Apr 28 '23 15:04

Arnaud Gourlay


This should do the trick:

App.ApplicationView = Ember.View.extend({

    didInsertElement: function(){
        $(document).foundation();
    }
});
like image 33
Jordy Langen Avatar answered Apr 28 '23 16:04

Jordy Langen