Created
January 14, 2014 23:27
-
-
Save robwormald/8428003 to your computer and use it in GitHub Desktop.
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
//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