Skip to content

Instantly share code, notes, and snippets.

@atticoos
Created September 2, 2014 22:04
Show Gist options
  • Select an option

  • Save atticoos/08e5600e145a83da1ee4 to your computer and use it in GitHub Desktop.

Select an option

Save atticoos/08e5600e145a83da1ee4 to your computer and use it in GitHub Desktop.
function MyService () {
var sharableData = [];
return {
data: sharableData,
doSomething: function () {
webSocket.on('gettinData', function (data) {
sharableData.push(data);
});
}
};
}
function MyController (MyService) {
$scope.packetData = MyService.data;
// maybe fire of some initializing to the service..
// MyService.startFetchingData(); // etc...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment