This project was forked from the ionic3-emoji-picker project created by danielehrhardt
- Fixed the AOT (Ahead Of Time) Compile error or simply put the ---prod build compile error.
- Upgraded the library from a Ng2 project to a Ng7 project.
- Upgraded the library RxJs from v5 to v6 to make it support new angular versions.
- Now compatible with Ng2 - Ng7 projects and as well as Ionic 3/4.
npm i ngx-emoji-picker --save
Import EmojiPickerModule.forRoot()
in your app's main module
app.module.ts
import { NgxEmojiPickerModule } from 'ngx-emoji-picker';
@NgModule({
...
imports: [
...
NgxEmojiPickerModule.forRoot()
],
...
})
export class AppModule {}
If your app uses lazy loading, you need to import EmojiPickerModule
in your shared module or child modules:
import { NgxEmojiPickerModule } from 'ngx-emoji-picker';
@NgModule({
...
imports: [
...
NgxEmojiPickerModule
],
...
})
export class SharedModule {}
<i
(click)="toggled = !toggled"
[(emojiPickerIf)]="toggled"
[emojiPickerDirection]="'bottom' || 'top' || 'left' || 'right'"
(emojiPickerSelect)="handleSelection($event)">😄</i>
toggled: boolean = false;
handleSelection(event) {
console.log(event.char);
}
<ion-textarea [(ngModel)]="message"></ion-textarea>
<button ion-button clear icon-only (click)="toggled = !toggled" [(emojiPickerIf)]="toggled" [emojiPickerDirection]="'top'"
(emojiPickerSelect)="handleSelection($event)">
<ion-icon name="md-happy"></ion-icon>
</button>
toggled: boolean = false;
message: string;
handleSelection(event) {
this.message += event.char;
}
<button ion-button
(click)="toggled = !toggled"
[(emojiPickerIf)]="toggled"
[emojiPickerDirection]="'bottom' || 'top' || 'left' || 'right'"
(emojiPickerSelect)="handleSelection($event)">
<ion-icon name="md-happy"></ion-icon>
</button>
$event = EmojiEvent{ char : "😌", label : "relieved" }
added for your convenience, emits information regarding a contenteditable enabled element
$event = CaretEvent{ caretOffset: 13, caretRange: Range{...}, textContent: 'content of div or input' }
Emoji Picker will get placed relative the element chosen via the directive api, centered and within window borders
This project was generated with Angular CLI version 7.1.2.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.