Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/paramsinghvc/ng2-emojis

An Angular 2 plugin for emojis support for text inputs and textareas
https://github.com/paramsinghvc/ng2-emojis

angular angular-2 angular2 emoji emoticons plugin rollup textarea typescript unicode

Last synced: 2 months ago
JSON representation

An Angular 2 plugin for emojis support for text inputs and textareas

Awesome Lists containing this project

README

        

# ng2-emojis
An Angular 2 plugin for emojis support for text inputs and textareas

screen shot 2017-02-26 at 11 03 15 pm

# Installation

`npm install ng2-emojis --save`

In your app.module.ts, include `EmojisModule` into the imports array as

```
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { EmojisModule } from 'ng2-emojis';

import { AppComponent } from './app.component';

@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
EmojisModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

```

Wrap your input or textarea element into an `emojify-holder` container element. And use the `emojiInput` attribute directive on the input element you want to "emojify" while passing the ngModel value into `emojiInputValue` property. That ngModel value is supposed to be changed by capturing the `emojiAdded` event on `emojify-holder` wrapper element.

```

```

The ts file goes like this

```
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
val: string = '🐘';
title = 'app works!';
emojiAdded(v) {
this.val = v;
}
}
```