Skip to content

Instantly share code, notes, and snippets.

@treyrich
treyrich / Example.js
Last active May 30, 2017 20:36
This is an AngularJS provider to communicate with a Sails.js backend via Socket.IO.After searching for way too long for a way to interface with the Sails.js client-side SDK included in new Sails projects via AngularJS I decided to write a drop in replacement for the AngularJS $http provider.Although this isn't a full replacement it includes a nu…
angular.module("MyApp", ["SocketProvider"])
.controller("MyController", ["$scope", "socket", function($scope, socket) {
// Fetch initial data
$scope.person = null;
socket.get("/person/1").success(function(data) {
$scope.person = data;
}).error(function() {