@Murali wrote:
Hi,
I have main component with a button. Whenever this button is clicked I want to instantiate and add a child component to a “div” in the main component . It’s like adding rows on button click. How do I implement this behavior.
Here is the pseudo code.
MainCompoent.hbs <div id="placeHolder> </div> <button onClick={{this.clickAdd}}> Add </button> MainCompoent.js @action clickAdd() { //How to initialize Row Component and add to the placeHolder // For example document.getElementById("placeHolder").innerHTML += `<RowComponent/>`; } RowComponent.hbs <div> <input name> <input age> </div>
Posts: 1
Participants: 1