使用Angular 2的Strophe XMPP [英] Strophe XMPP using Angular 2

查看:85
本文介绍了使用Angular 2的Strophe XMPP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在angular2项目中为Strophe.JS XMPP库创建服务.该服务负责打开和关闭连接,并包括接收消息的处理程序.我能够在.Net MVC项目中进行操作,但没有找到在Angular2框架中实现的方法.

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.

谢谢,桑耶夫

推荐答案

首先安装@ types/strophe

First to install @types/strophe

npm install --save @types/strophe

第二次从 Strophe站点下载Strophe库

Second to download Strophe library from Strophe Site

然后,您应该将框架放入/src/assets/

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

然后,您应该将脚本标记添加到polyfills.js和main.js之前的index.html

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

因此

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

最后

您应该在使用该引号之前放置此clarify语句.

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

declare var Strophe: any;

对我有用!

希望对您有所帮助.

致谢.

这篇关于使用Angular 2的Strophe XMPP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆