简体   繁体   English

使用angularjs创建facebook风格的聊天

[英]Creating a facebook style chat with angularjs

I'm fairly new with angularjs and javascript as a language. 我对angularjs和javascript作为一种语言相当新。 I don't need help with the sending and displaying, I'm using pusher to make it instant and ng-repeat to display the messages and all that part is working. 我不需要发送和显示的帮助,我正在使用推动器使其立即和ng-repeat显示消息和所有部分正在工作。

I'm having a problem creating a chat box for each user like facebook. 我在为facebook等每个用户创建聊天框时遇到问题。 I can understand one could use the jquery clone(). 我可以理解可以使用jquery clone()。 There also $compile in angular with I could use but I'm not sure which would be the best way to go about doing this. 我也可以使用$ angular with angular但我不确定哪种方法可以做到最好。

I'm just looking for someone who knows what there doing! 我只是在找一个知道在做什么的人!

Thanks, Alfred 谢谢,阿尔弗雷德

Have you got your code up on GitHub or somewhere that I can have a look at what you've got so far? 你有没有在GitHub或某个地方获得你的代码,我可以看看你到目前为止有什么?

Without seeing any code it's tricky to give specific advice but with that said, this sounds like a good use case for ng-repeat and a "chat box" directive. 在没有看到任何代码的情况下,提供具体的建议很棘手,但据说,这听起来像ng-repeat和“聊天框”指令的一个很好的用例。 If you have an array in your Angular code that stores all of the open chats you have with other people then you could use an ng-repeat in your view to display all of the chat boxes using a chat box directive. 如果您的Angular代码中有一个数组存储了您与其他人的所有打开聊天,那么您可以在视图中使用ng-repeat来使用聊天框指令显示所有聊天框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM