Created
July 14, 2015 18:16
-
-
Save rfong/2e6186889ea348928059 to your computer and use it in GitHub Desktop.
object oriented JS with angular factories
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
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