Created
April 23, 2014 17:33
-
-
Save subtubes-io/11225323 to your computer and use it in GitHub Desktop.
AngularJS Model Sample
This file contains hidden or 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
| (function () { | |
| "use strict"; | |
| angular.module("exampleApp") | |
| .provider("Person", function () { | |
| this.$get = [function () { | |
| var Person = function (id) { | |
| if(!(this instanceof Person)){ | |
| return new Person(id); | |
| } | |
| if (Person.cached[id]) { | |
| return Person.cached[id]; | |
| } | |
| Person.cached[id] = this; | |
| }; | |
| Person.prototype.name = "Guest"; | |
| Person.cached = {}; | |
| return Person; | |
| }]; | |
| }) | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment