vendredi 16 juin 2017

How to create .hbs for a component in non CLI mode

I'm not using Ember-CLI

Im creating many components at a time in my script and some may be block and some not. I cannot create separate files for each components as the array to create components may change. I need to check whether the component is block or not, to yield its content and render using that content.

Application.js

App[componentArr[i].name + "Component"] = Ember.Component.extend({
            tagName: componentArr[i].tag,
            init: function () { },
            didReceiveAttrs: function () { },
            willRender: function () { },
            didInsertElement: function () {
                //i will render the logic here.
                //need to check block params if yes  that and render 
                //if no just render.
            },
            didRender: function () { }
        });

I can create a <script> tag for each component and append it in the body. but that is proper when the array got more than 100 items.

I need to do this in this type not by ember-CLI as i cannot loop and create components there.

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire