Last active
August 29, 2015 14:10
-
-
Save ungoldman/0b471961cfc51b13b37c to your computer and use it in GitHub Desktop.
angular service/factory patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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