.controller('order_completed', function($scope,$http,$state,socket) {
var order = localStorage.getItem('order');
socket.on('connect', function(data) {
socket.emit('order', order);
});
});
not sure why I need to refresh then only can see the emit got executed. I use $state.go('order') to come to this page.