Consider the following piece of code
import {Component, OnInit} from 'angular2/core';
import {bootstrap, BrowserDomAdapter} from 'angular2/platform/browser';
@Component({
selector: 'app',
template: `<div id="test"></div>
<br>Current Value is: {{ name }}`
})
class App implements OnInit{
public name = "Hello World!";
constructor() {}
ngOnInit(){
$("#test").append("<input type='text' [(ngModel)]='name' placeholder='Enter Name' />");
}
}
bootstrap(App);
As you can see I am adding a template dynamically to the DOM and binding the name attribute to it. But the resulting input textbox is not binding with the name. I am newbie and I know this may not be the right way. If so, what could be the right way to achieve this?