【问题标题】:Angular 2, textarea (append emoji with text)Angular 2,textarea(用文字附加表情符号)
【发布时间】:2018-06-24 20:02:34
【问题描述】:

我想在短信中附加表情符号。

<textarea class="msgarea" * [(ngModel)]="msg" name="message-to-send" id="message-to-send"  placeholder="Type your message" rows="3">
</textarea>

用表情符号显示消息

<div class="message-container" [innerHTML]="msg | emojis">
</div>

我想在文本区域显示所有表情符号。请看附件图片。

我正在使用this 表情符号参考。

【问题讨论】:

  • 我们能提供什么帮助?

标签: javascript node.js angular


【解决方案1】:

在 html 中添加一个按钮,点击按钮时会弹出表情符号。

在打字稿文件中调用这个函数

toggleEmojiPicker() {
    console.log(this.showEmojiPicker);
        this.showEmojiPicker = !this.showEmojiPicker;
  }

  addEmoji(event) {
    console.log(this.message)
    const { message } = this;
    console.log(message);
    console.log(`${event.emoji.native}`)
    const text = `${message}${event.emoji.native}`;

    this.message = text;
    // this.showEmojiPicker = false;
  }

click for stackbliz example 这是 stackbliz 工作示例链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-24
    • 1970-01-01
    • 2021-06-01
    • 1970-01-01
    • 2018-02-14
    • 2020-06-07
    • 2016-02-29
    相关资源
    最近更新 更多