Skip to content

Instantly share code, notes, and snippets.

@jrthib
jrthib / AnotherController.js
Created Jul 16, 2014
Factory using promises to start the socket.io authentication and session after logging into an Angular app.
View AnotherController.js
(function() {
'use strict';
function AnotherController($scope, socket) {
// use the socket factory through your app, but you must use socket.then
// so that the actions occur once the socket is established
socket.then(function(socket) {
socket.emit('some_socket_event', {});
});