I have a model which contains information about selects, inputs and etc. I found the way to connect it to my view.
export default Em.View.extend({
didInsertElement: function(){
var content = this.get('content'),
self = this;
content.content[0].default.forEach(function(item,i){
if (item.tag == 'select') {
self.$().append('<select></select>');
item.content.forEach(function(item){
self.$('select:last-child').append('<option>'+item.option+'</option>');
});
}
else if (item.tag == 'input') {
self.$().append('<input type='+item.type+'>');
}
});
}
});
Is there a way to not use:
self.$('select:last-child').append('<option>'+item.option+'</option>');
And have some kind of
Ember.compile('{{Ember.select content=options valueBinding=example}}');
Thanks!
P.S. Sorry if you find my way to do it to be silly, i just started to learn Ember and may be I still think in jquery's way. And sorry for my English!
Aucun commentaire:
Enregistrer un commentaire