Code Monkey home page Code Monkey logo

Comments (5)

lentschi avatar lentschi commented on August 24, 2024 2

@wilson0506

In your html:

<emoji-mart (emojiSelect)="addEmoji($event)"></emoji-mart>

And in your component:

public addEmoji(event: {$event: MouseEvent, emoji: EmojiData}) {
  let emoticonElement = <HTMLElement> event.$event.target;
  if (!emoticonElement.style.backgroundImage || emoticonElement.style.backgroundImage === '') {
    emoticonElement = <HTMLElement> emoticonElement.firstChild;
  }
  console.log(emoticonElement.outerHTML); 
  // -> will give you the emojis html, which you can use for [innerHTML] etc.
}

Note that you will only need this if you're using some none-angular component or into a contenteditable. Otherwise you can just use <ngx-emoji [emoji]="emojiEventReturnedByPicker.emoji.id"></ngx-emoji> and then wrap this in a *ngIf or a *ngFor - whatever you need.

from ngx-emoji-mart.

ndkcha avatar ndkcha commented on August 24, 2024

add (emojiClick)="addEmoji($event)" event to your html binding.

and then in your add emoji function.
(HTMLInputElement).value += event.emoji.native

I think it's already listed in the README.md file

from ngx-emoji-mart.

wilson0506 avatar wilson0506 commented on August 24, 2024

Sorry for bothering, if use emoji native like 😍,
it will show up accordingly to the platform, like iphone showing apple version.

How to apply theme to it, let say if i want to change to twitter version, what should i do?

one more question, is it possible to convert html into
<ngx-emoji=':smiley" size="16"> by regex
and display it using [innerHtml] or sth like that .

Cheers

from ngx-emoji-mart.

NaimishVerma17 avatar NaimishVerma17 commented on August 24, 2024

innerHTML doesn't render angular components....

from ngx-emoji-mart.

scttcper avatar scttcper commented on August 24, 2024

should be easier with the new function added to emoji service https://github.com/TypeCtrl/ngx-emoji-mart#display-emoji-as-custom-element

closing in favor of #89

from ngx-emoji-mart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.