Skip to content

Instantly share code, notes, and snippets.

@tilleps
Created June 19, 2013 00:32
Show Gist options
  • Save tilleps/5810777 to your computer and use it in GitHub Desktop.
Save tilleps/5810777 to your computer and use it in GitHub Desktop.
// doesn't work
App.ApplicationView = Ember.View.extend({
didInsertElement: function() {
$(document).foundation();
}
});
// works
App.ApplicationView = Ember.View.extend({
didInsertElement: function() {
setTimeout(function() {
$(document).foundation();
}, 0);
}
});
@tilleps
Copy link
Author

tilleps commented Jun 19, 2013

Thanks to Zaxnyd for the reference: http://stackoverflow.com/questions/11724350/ember-js-ember-view-didrender-event

Use "Ember.run.next()" instead of setTimeout

Example:

App.ApplicationView = Ember.View.extend({
  didInsertElement: function() {    
    Ember.run.next(this, function(){ 
      $(document).foundation(); 
    })
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment