Loading a 3rd party embed widget within a View


#1

I’m loading the RebelMouse embed widget into an Ember.View, like so:

App.RebelMouseView = Em.View.extend({
didInsertElement: function() {
    var widgetEmbedCode = '<script type="text/javascript" class="rebelmouse-embed-script" src="https://www.rebelmouse.com/static/js-build/embed/embed.js?site=W3portals&height=900&flexible=1"></script>';
    
     this.$().append(widgetEmbedCode);
   }
});

But I’m hoping there’s a better way to do so.

One undesired side-effect is that everytime I initialize that view it reloads the entire widget with a 1 second delay. Thanks.


#3

Sorry, moved this question to StackOverflow


#4

FYI. It looks like this is an edge case that just can’t be done within an Ember.View.

Here’s where I have this ‘kinda’ working: http://bradoyler.github.io/ember-startersite/#/about

The only problem is when u navigate to another route and then back, the widget has to reload.