0.2.0 • Published 7 years ago

ng2-emoji v0.2.0

Weekly downloads
134
License
MIT
Repository
github
Last release
7 years ago

ng2-emoji

image

Installation

To install this library, run:

$ npm install ng2-emoji --save

Demo Example

See the live example (Angular4 project) here

Usage

VERY IMPORTANT In one of your css/scss files. include these styles:

.emoji{
    display:inline-block;
}

In your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

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

// Import your library
import { Ng2EmojiModule } from 'ng2-emoji';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Include the awesome
    Ng2EmojiModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

In your index.html:

<link href="./node_modules/ng2-emoji/css/ng2-emoji.css" rel="stylesheet">

OR if using angular-cli.json, use:

 "apps": [
    {
      ...
      "styles": [
        "styles.css",
        "../node_modules/ng2-emoji/css/ng2-emoji.css"
      ],
      ...
  ]

In your component where you want to use ng2-emoji, just use:

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

where the model myMessageString inside your @Component will be:

...
export class MyComponent {
    public messageString: String = "";
    constructor() {
        this.myMessageString = 'Hello, how are you? :smile: It was fun at the bowling game the other day :joy:';
    }
}

Development

Clone the repository:

git clone https://github.com/AhsanAyaz/ng2-emoji

Install dependencies

npm install

To build the library:

npm run build

To generate the spritesheet :

gulp sprite

To lint all *.ts files:

npm run lint

Run example locally

Perform the following steps to serve the Angular example locally. Navigate to http://localhost:4200 after that.

cd example
npm install
ng serve

Contribution

Feel free to contribute to this repo by:

  • Adding Examples
  • Resolving open issues

Thanks to Juan Carlos for the amazing Angular example

License

MIT © Ahsan Ayaz

0.2.0

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.0

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago