dimanche 15 novembre 2015

Do something when the DOM is completly loaded with ember

I'm working with an Ember 2.1.0 application. I want to apply JQuery Steps when the dom is ready. When I do this :

import Ember from 'ember';

export default Ember.Controller.extend({
  trigger: function() {
    console.log($('#subscription-form').length);
  }.on('init')
});

This code show a length of 0. When I do it later, the length is 1.

Can I trigger something when the dom completly loaded? Something similar as $(document).ready in JQuery?

Should I use a component? What are best practices? Is there something somewhere in the documentation?

Aucun commentaire:

Enregistrer un commentaire