Skip to content

Instantly share code, notes, and snippets.

@ungoldman
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ungoldman/0b471961cfc51b13b37c to your computer and use it in GitHub Desktop.
Save ungoldman/0b471961cfc51b13b37c to your computer and use it in GitHub Desktop.
angular service/factory patterns
angular.service('zoningLayer', function(){
var privateVariable = 'derp';
function privateFunction () {}
this.create = function() {
return new L.whatever(function(){
return {
fill: privateVariable(privateFunction),
ping: pong,
ding: dong
}
});
};
});
// OR
angular.factory('zoningLayer', function(){
var zoningLayer = {};
var other, things;
zoningLayer.create = function(){};
return zoningLayer;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment