javascript - 如何在带有指令的angularjs中使用表情符号选择器库?

标签 javascript jquery angularjs angularjs-directive

我得到了这个表情符号库:

https://github.com/one-signal/emoji-picker

我在考虑做一个指令,这是使用表情符号选择器的函数:

$(function() {
  // Initializes and creates emoji set from sprite sheet
  window.emojiPicker = new EmojiPicker({
    emojiable_selector: '[data-emojiable=true]',
    assetsPath: 'lib/img/',
    popupButtonClasses: 'fa fa-smile-o'
  });
  // Finds all elements with `emojiable_selector` and converts them to rich emoji input fields
  // You may want to delay this step if you have dynamically created input fields that appear later in the loading process
  // It can be called as many times as necessary; previously converted input fields will not be converted again
  window.emojiPicker.discover();
});

这是表情符号的 html 使用:

  <p class="lead emoji-picker-container">
    <textarea class="form-control textarea-control" rows="3" placeholder="Textarea with emoji Unicode input" data-emojiable="true" data-emoji-input="unicode"></textarea>
  </p>

我怎么能为我的 Angular 项目做到这一点?谢谢你帮助我!

最佳答案

ng-emoji-pickerhttps://github.com/OneSignal/emoji-picker 的 Angular Directive(指令)

它删除了 Original Emoji Picker 的所见即所得编辑器使用它将您的输入/文本区域转换为 div,而只是在当前文本框或输入上添加表情符号选择器图标,并使用 unicode 添加表情符号

关于javascript - 如何在带有指令的angularjs中使用表情符号选择器库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37404121/

相关文章:

javascript - 是否可以仅使用 HTML 和服务器端(Node)js 在 Node/Express 中发出 post 请求?

jquery - 如何将自定义行为附加到 jsTree 中的双击?

javascript - 如何过滤带有多个参数的json对象?

javascript - 将一个单词中的所有字母替换为js中的*

javascript - 为什么无法读取此 JSON 属性?

javascript - 使用javascript为网站body标签中的所有数字添加一个span

javascript - Jquery通过调用相同的名称获取正确的元素ID?

javascript - 使用 jQuery 提交表单的问题

javascript - 我是 Angular.js 新手,我只是尝试使用 Angular.js 创建登录表单

javascript - 如何减小 Angular JS 应用程序的大小,其中 vendor .js 为 2MB,app.js 为 720KB?