Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created January 14, 2014 23:27
Show Gist options
  • Save robwormald/8428003 to your computer and use it in GitHub Desktop.
Save robwormald/8428003 to your computer and use it in GitHub Desktop.
//factory syntax
angular.factory('myModelThingy',function($http){
//private vars
var _someThings = []
var _someOtherThings = []
//private functions
function doSomeStuff(){
}
function doSomeOtherStuff(){
}
//everything below this line is the "public" API
return {
someThings : _someThings,
getSomeOtherThings : function(){
return _someOtherThings;
},
doSomething : function(params){
return doSomeStuff()
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment