Is there a way to incorporate the functions from these libraries into my Angular factory?
<head>
<script type="text/javascript" src="js/3rdparty/strophe.js"></script>
<script type="text/javascript" src="js/3rdparty/xml2json.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controller.js"></script>
</head>
I have a factory and a controller. I would like to integrate the libraries (strophe.js, xml2json.js) into my Angular code.
This is how I am attempting to use them, but I keep encountering errors:
angular.module('fairy_chat.services',['globals'])
// ----------- chat factory : ------------------
.factory('chat_factory', function (CONSTANT, strophe){
var chat_service_obj = {
var connection = new Strophe.Connection(CONSTANT.BOSH_SERVICE);
console.log(connection);
connect_server:function (){
console.log('constant=='+ CONSTANT.BOSH_SERVICE );
}
}
return chat_service_obj;
});
My controller.js
angular.module('fairy_chat.controllers',['fairy_chat.services','ionic','globals'])
.controller('LoginCtrl', function($scope, $state, chat_factory) {
$scope.data = {
username:"",
password:""
};
$scope.login = function(strophe){
chat_factory.connect_server();
}
})