I have component called display-me. I can add multiple of that same component to thesame template as shown in the jsfiddle by adding multiple calls to that component like this:
<script type="text/x-handlebars" data-template-name="index">
{{display-me action='add'}}
{{display-me action='add'}}
</script>
However, what I desire, is a situation where I can click a button to add the second entry for the component instead of adding it manually as above because I want use to click and add as many as that want.
I have added this action to my index route but it doesn't work:
App.IndexRoute = Ember.Route.extend({
actions: {
add: function(){
var comp = App.__container__.lookup("component:display-me");
//var comp = App.DisplayMeComponent.create();
//comp.appendTo(".test");
//comp.appendTo('#input');
Ember.$(".test").append($('<div> {{display-me action="add"}} </div>'));
}
}
});
Here is the complete jsfiddle