Hi,
I'm new to angular Js. I'm using service and i'm getting back the values.
but i'm not able to access those values outside the service call. Plz help
me to access the values outside also. Below is my code. And i'm using
Socket.io. Sorry if my wordings are not proper.
$scope.myId="";
$scope.chatSocket.on('connect', function () {
var userMyName=this;
console.log('Connection Established!!');
// call the server-side function 'adduser' and send one
parameter (value of prompt)
DBService.getUserInfo().then(function(data) {
if(data != 'NULL') {
$scope.myId = data(0).user_id;
$scope.chatSocket.emit('adduser', userMyName);
}
});
});
$scope.sendMessage = function(myName) {
// This function will call after i click on button
console.log($scope.myId);
// I get blank value here
};
both are in same controller.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.