I'm trying to learn angular2 (and Typescript) and having followed the quick start guide and a few unofficial tutorials I've made progress to have a simple application with some components.
I understand the process of binding model data to the DOM element using the bracketed notation in my templates: <h1>{{title}}</h1>
What I'm struggling to understand is how I could dynamically instantiate a new component from within my Typscript code, and then render that in the DOM.
If I import a component to my file and instantiate a new one, that will trigger the component's constructor in the model. Does Angular2 then allow me to render this, or append a component to another component or queried div element?
import {ListComponent} from './list.component';
...
export class MainAppComponent {
buttonClicked(){
// I'm creating a new list component. What is the proper way to render it within this MainAppComponent?
this.list = new ListComponent();
}
}