Monday 29 May 2017

ionic 2 with strophe not working?

I am currently trying to use strophe with ionic 2, I have npm both strophe and jquery and also @types/strophe and typings.

this is my code

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {Strophe} from 'strophe';


@Component({
selector: 'page-home',
templateUrl: 'home.html',


})
export class HomePage {


public connection: any ;

public BOSH_SERVICE: any="http://52.32.***.5:5280/http-bind/" ;


constructor(public navCtrl: NavController) {

}


login() {


this.connection = new Strophe.Connection(this.BOSH_SERVICE);
this.connection.connect('ama****'+'@'+'localhost', 'o***oop',                                     

this.onConnect);

console.log("Hello World !");

 }



onConnect(status) {
console.log('onConnect: '+status);
}

when I try ionic serve I get this error TypeError: WEBPACK_IMPORTED_MODULE_2_strophe.Strophe is undefined Stack trace: HomePage.prototype.login@http://localhost:8100/build/main.js:55747:9 View_HomePage_0/<@ng:///AppModule/HomePage.ngfactory.js:135:21 viewDef/handleEvent@http://localhost:8100/build/main.js:12170:98 callWithDebugContext@http://localhost:8100/build/main.js:13462:39 debugHandleEvent@http://localhost:8100/build/main.js:13050:12 dispatchEvent@http://localhost:8100/build/main.js:9070:12 renderEventHandlerClosure/<@http://localhost:8100/build/main.js:9662:20 decoratePreventDefault/<@http://localhost:8100/build/main.js:33505:53 fhttp://localhost:8100/build/polyfills.js:3:9644 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@htt p://localhost:8100/build/main.js:4397:28 fhttp://localhost:8100/build/polyfills.js:3:9557 chttp://localhost:8100/build/polyfills.js:3:4812 t/this.invoke@http://localhost:8100/build/polyfills.js:3:10626



via amar essa

No comments:

Post a Comment