ionic $state doesn't trigger socket emit

2019-09-08 10:00发布

问题:

.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.