angular 2 个图像支持输入
angular 2 input with image support
我想用 angular 2 创建一个聊天应用程序,我需要在输入字段中显示表情符号,但 html 不支持在输入字段中显示图像。
我也试过这种方式,但没有奏效:
<div contenteditable="true"
[innerHtml]="msgText"
class="form-control"
(keyup)="enable_disable_sendBtn()"
(keypress)="handle_enter_key($event)"
#messageBox
(input)="msgText = $event.target.innerText">
</div>
我试过 this 但没有 我收到 tslint
的错误并说:use @HostListener Or @HostBinding instead of host
.
谁能帮我在文本输入中显示 emjis?
终于找到解决办法了。解决方案是一种绑定方式,导致用户在 contenteditable
中写了一些东西,而我只需要在需要时获取 innerHTML
例如:何时发送内容。
另外,当我想向内容添加图像时,只需添加到 contenteditable
,当我需要发送(或类似的东西)时,我会得到 innerHTML
。
<div contenteditable="true"
class="form-control"
id="messageBox"
#messageBox
(keydown.enter)="handle_enter_key($event)"
(input)="handleMessageBoxInput($event)">
</div>
我想用 angular 2 创建一个聊天应用程序,我需要在输入字段中显示表情符号,但 html 不支持在输入字段中显示图像。
我也试过这种方式,但没有奏效:
<div contenteditable="true"
[innerHtml]="msgText"
class="form-control"
(keyup)="enable_disable_sendBtn()"
(keypress)="handle_enter_key($event)"
#messageBox
(input)="msgText = $event.target.innerText">
</div>
我试过 this 但没有 我收到 tslint
的错误并说:use @HostListener Or @HostBinding instead of host
.
谁能帮我在文本输入中显示 emjis?
终于找到解决办法了。解决方案是一种绑定方式,导致用户在 contenteditable
中写了一些东西,而我只需要在需要时获取 innerHTML
例如:何时发送内容。
另外,当我想向内容添加图像时,只需添加到 contenteditable
,当我需要发送(或类似的东西)时,我会得到 innerHTML
。
<div contenteditable="true"
class="form-control"
id="messageBox"
#messageBox
(keydown.enter)="handle_enter_key($event)"
(input)="handleMessageBoxInput($event)">
</div>