1.0.0 • Published 5 years ago

ngx-wachat v1.0.0

Weekly downloads
25
License
MIT
Repository
github
Last release
5 years ago

NgxChat

Chat UI Component for Angular Applications

Live Demo

Source Code

npm.io

Installation

Use the package manager npm to install the chat.

npm install ngx-wachat --save

Usage

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

import { AppComponent } from './app.component';
import { NgxWachatModule} from 'ngx-wachat';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxWachatModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

In Your HMTL

<ngx-wachat [contacts]="contacts" [origin]="from" (sendMessage)="onSendMessage($event)"></ngx-wachat>

Properties

PropertyDescriptionTypeDefault
contactsArray of contactsChatContact[][]
originUser origin of the messageChatContactnull
placeholderPlaceholder text of field that send's messagestringSay Hi
heightHeight of chat windowstring400px
widthWidth of chat windowstring350px
colorHeader color of chat windowstring#629ce4
emptyListDescriptionText of label when list of contacts is emptystringNo Contacts Found

Events

EventDescriptionvalue
sendMessageEmitted when user press enter on field to send messageChatMessage

Methods ChatService

MethodDescriptionParameter
loadMessagesMethod that (first) load messages to chatChatMessage[]
sendMessageMethod that append message received from serverChatMessage

Interface ChatContact

PropertyDescriptionType
idId of chat contactstring or number
nameName of chat userstring
descriptionSub text shown just below the name of chat userstring
statusStatus of chat user on chatChatStatus
avatarPath of avatar imagestring

Interface ChatMessage

PropertyDescriptionType
originUser chat, origin of the messageChatContact
destinationUser chat, destination of the messageChatContact
messageThe string messagestring
dateDate of message ( generated from server or not)Date

License

MIT