angular-simple-chat

AngularJS chat directive
Homepage:
0 people use it

angular-simple-chat

AngularJS chat directive

AngularJS chat directive

Requirements

"angularjs": "~1.4.9"

angular-moment amTimeAgo copied internaly because of unit testing issue with angular-moment AMD configuration

Installation

Install with Bower

bower install --save angular-simple-chat

Add the dependencies to your index.html manually or using tool like wiredep

<!-- Dependencies -->

<!-- Simple Chat -->

Load the module in your app

angular.module('app', ['angular-simple-chat']);

Use it in any template

<simple-chat messages="AppView.messages" local-user="AppView.you" to-user="AppView.guy"

Running the example

To run the example page, just run

gulp serve

and open your browser on http://localhost:3000/example/

Documentation

Params

  • messages: array of messages to show. (required) Message format is : {id: 'string', text: 'string', userId: 'string', date: '1455120273886'}
  • local-user: user object of the user using the app (required) {userId: 'string', avatar: 'string', username: 'string'}
  • to-user: user object of the other user using the chat (required) {userId: 'string', avatar: 'string', username: 'string'}
  • send-function: function called when user click on send button (required)

  • send-button-text: (optional)

  • composer-placeholder-text: (optional)

  • show-user-avatar: boolean (optional)

Events

simple-chat-message-posted

Event sended when local user send a message

TODOS

  • Display message "time ago" with these rules :
    • if message.date < 1 week && < 3 days ago : display " today/yesterday/the day before yesterday + HH:mm "
    • if message.date < 1 week && > 3 days ago : display " day + HH:mm "
    • if message.date > 1 week : display " day. X month (YYYY) + HH:mm "
comments powered by Disqus
This page was last updated about 1 year ago.