Skip to content

Instantly share code, notes, and snippets.

@rfong
Created July 14, 2015 18:16
Show Gist options
  • Save rfong/2e6186889ea348928059 to your computer and use it in GitHub Desktop.
Save rfong/2e6186889ea348928059 to your computer and use it in GitHub Desktop.
object oriented JS with angular factories
var app = angular.module('someObject', []);
app.factory('SomeObject', function($http) {
var SomeObject = function(someObject) {
angular.extend(this, someObject);
var self = this;
this.initialize = function() {
// pass
};
// Call init function for every new instance
this.initialize();
};
// Return a reference to the function
return (SomeObject);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment