Strophe XMPP using Angular 2

荒凉一梦 提交于 2019-12-13 15:39:11

问题


I want to create service for Strophe.JS XMPP library in angular2 project. That service is responsible for Open and Close connection and include handler to receive message. I am able to do in .Net MVC project but i did not found a way to implement in Angular2 framework.

Thanks, Sanjeev


回答1:


First to install @types/strophe

npm install --save @types/strophe

Second to download Strophe library from Strophe Site

Then, You should put the framework inside /src/assets/

Then, You should add the script tag to the index.html before polyfills.js and main.js

Thus

<script src="assets/strophejs-1.2.14/strophe.js"></script>

Last,

you should put this declare statement before to use the strophe.

declare var Strophe: any;

It works for me!

I hope to help you.

Regards.



来源:https://stackoverflow.com/questions/43965906/strophe-xmpp-using-angular-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!