lundi 8 août 2016

How do I embed an Ember.js app in other sites without an iframe

I'm looking to embed an ember app into various sites using a javascript snippet. I have a widget that loads some posts from an api and I want to be able to load the app into a container div. I've researched all of the answers to similar questions on here, and all I can gleen is the basics of changing the rootElement and location as Ember docs say. But I can't find any clear help on the javascript to load the ember app on page, or any init stuff I need to do in the ember app itself.

We previously had something similar working with straight javascript with this:

<script type="text/javascript" src="http://ift.tt/2aN9dsI" charset="utf-8"></script>
<script type="text/javascript" >
    var script = document.createElement('script');
    script.src = "http://ift.tt/2aAX46Q" + window.location.hostname + "&relative_url=" + window.location.pathname;
    document.body.appendChild(script);
</script>

I'm clearly ember n00b here, so any direction would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire