未捕获(承诺):ReferenceError:未定义Strophe

时间:2018-10-08 06:56:51

标签: html5 typescript ionic3 angular5 quickblox

为什么我会得到未定义Strophe 这种错误,当我按照此链接中的解决方案正确安装Strophe时: https://forum.ionicframework.com/t/integrate-quickblox-in-ionic-2/81726

首先,我使用strophe.js进行安装,    npm install strophe.js

然后使用 npm install strophe

安装Strophe

然后添加index.html文件:    脚本src =“ strophe.js”

和.ts文件代码为:

import * as $ from "jquery";
import * as quickblox from "quickblox";
import * as Strophe from 'Strophe';

CREDENTIALS:any = {
 appId: 73870,
 authKey: 'ffzhPELMPfcZ8ZK',
 authSecret: '7a-VJ6dsBNT77t7'
};

user:any = {
 id: 24786158,
 login: 'test',
 pass: 'qwerty1234'
};

quickblox.init(this.CREDENTIALS.appId, this.CREDENTIALS.authKey, this.CREDENTIALS.authSecret);
quickblox.createSession(
  {login: this.user.login, password: this.user.pass},
  (err, result) => { //THIS LINE HAS BEEN CHANGED <-
    if (result){
      quickblox.chat.connect(
        {userId: this.user.id, password: this.user.pass},
        (err, roster) => { //THIS ONE TOO <-
          if (err){
            console.log(err);
          }
        });
    }       
    console.log(err);
    console.log(result);
});

if anybody have solution to solve this issue, please help me here.

0 个答案:

没有答案