0
我想创建一个输入元素从typescript到角4中的html。但是当我尝试把[(ngModel)]
不起作用。我如何做这个方法?有人知道如何?文档setAttribute ngModel Angular
createElement() {
this.input = document.createElement('input');
this.input.setAttribute('matInput', '');
this.input.setAttribute('placeholder', 'Tema');
this.input.setAttribute('[(ngModel)]', 'module.theme');
this.input.setAttribute('name', 'theme');
return (<HTMLDivElement>(document.getElementById('ejemplo').appendChild(this.input)));
}