1

I have issue with chat UI component style it show as follow enter image description here

here is my code

<nb-layout>
    <nb-layout-column>
        <nb-chat title="Chat APP">
            <nb-chat-message *ngFor="let msg of messages"
                             [type]="msg.type"
                             [message]="msg.text"
                             [reply]="msg.reply"
                             [sender]="msg.name"
                             [date]="msg.date"
                             [quote]="msg.quote"
                             [avatar]="msg.avatar">
            </nb-chat-message>
        
            <nb-chat-form (send)="sendMessage($event)" [dropFiles]="false">
            </nb-chat-form>
        </nb-chat>
    </nb-layout-column> </nb-layout>

chat-room.component.ts code

import { Component, OnInit } from '@angular/core';
import { ChatService } from 'src/app/Services/chat.service';

@Component({
  selector: 'app-chat-room',
  templateUrl: './chat-room.component.html',
  styleUrls: ['./chat-room.component.scss'],
})
export class ChatRoomComponent implements OnInit {
  messages: any[] = [];

  constructor(protected chatService: ChatService) {
    this.chatService.getMessage().subscribe((data: any) => {
      console.log(data);
      this.messages.push(data);
    });
  }

  ngOnInit(): void {}

  sendMessage(event: any) {
    var payload = {
      text: event.message,
      date: new Date(),
      reply: true,
      type: 'text',
      name: 'Jonh Doe',
      avatar: 'https://i.gifer.com/no.gif',
    };
    this.messages.push(payload);

    this.chatService.sendMessage(event.message);
  }
}

The style is not right and the other screen it shows only the circles without any text I am not able to find any solution can anyone help with this ?

Ali Mardini
  • 185
  • 1
  • 16

0 Answers0