Angular< p>由 *ngfor赢得冠军
我进行了此聊天,我正在尝试将样式应用于“ chat-container” 。
这些消息以Angular的*NGFOR
显示:仅
<p *ngFor="let m of messageArray" [ngClass]="this.currentUser.user._id==m.src?'self pr-3':'otherUser pl-3'">
{{m.msg}}
</p>
应用的类仅具有float:左
或 float:right 取决于发送的用户每个消息。但是,它们总是在左边显示。
关于如何使消息浮动到相应的一侧的任何建议吗?
I have this chat in which I'm trying to apply styles to the "chat-container".
The messages are displayed with Angular's *ngFor
as follows:
<p *ngFor="let m of messageArray" [ngClass]="this.currentUser.user._id==m.src?'self pr-3':'otherUser pl-3'">
{{m.msg}}
</p>
The classes applied only have float:left
or float:right
depending on the user that sent each message. However, they're always being displayed in the left.
Any suggestions on how to make the messages float to their corresponding side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 flexbox
在CSS上:
使用 width /em>在父级上覆盖可用空间。(您可以使用PX或%设置宽度)
use flexbox
on CSS:
use width on parent div to cover the available space.(you can set the width with px or % is up to you)