Skip to content
Jakub Mikos edited this page May 2, 2023 · 9 revisions

Welcome to the ngx-chat wiki!

Guides

Replaceable Injectables

One can use for example @Inject(CHAT_SERVICE_TOKEN) private chatService: ChatService in the constructor to use the provided service in your parent module {provide: CHAT_SERVICE_TOKEN, useValue: newChatService}.

/**
 * The chat service token gives you access to the main chat api and is implemented by default with an XMPP adapter,
 * you can always reuse the api and ui with a new service implementing the ChatService interface and providing the
 * said implementation with the token
 */
export const CHAT_SERVICE_TOKEN = new InjectionToken<ChatService>('ngxChatService');
/**
 * You can provide your own implementation for {@link LinkOpener} to override link opening e.g. when using Cordova.
 */
export const LINK_OPENER_TOKEN = new InjectionToken<LinkOpener>('ngxChatLinkOpener');
/**
 * Optional injectable token to handle contact clicks in the chat
 */
export const CONTACT_CLICK_HANDLER_TOKEN = new InjectionToken<ChatContactClickHandler>('ngxChatContactClickHandler');
/**
 * Optional injectable token to handle contact reports in the chat
 */
export const REPORT_USER_INJECTION_TOKEN = new InjectionToken<ReportUserService>('ngxChatReportUserService');
Clone this wiki locally