【发布时间】:2017-10-17 18:02:25
【问题描述】:
我正在尝试以角度 4 创建从 typescript 到 html 的输入元素。但是当我尝试 put [(ngModel)] 时不起作用。我怎么做那个方法?有人知道吗?
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)));
}
【问题讨论】:
标签: html angular typescript