mercredi 18 mai 2016

Ember - Dynamically create a component

I'm working on a module which needs to register components with Ember, Angular, React etc. depending on what is loaded into the page.

With React I can just do

if (window.React) {
  React.createClass(...

But how can I do the same with Ember? I'm looking for something like:

if (window.Ember) {
  Ember.registerComponent('my-component-name', Ember.Component.extend({
    ...
  }));
}

Is this possible? Bearing in mind I don't have access to the Ember App on the page.




Aucun commentaire:

Enregistrer un commentaire