Created
          September 8, 2014 17:19 
        
      - 
      
- 
        Save aaronfrost/f3765155ab0d1973c788 to your computer and use it in GitHub Desktop. 
    Angular - Rich Data Model Pattern
  
        
  
    
      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
    
  
  
    
  | angular.module('app').run(function($q, $timeout){ | |
| function User(data){ | |
| if(this == window)return new User(data); | |
| angular.extend(this, data); | |
| } | |
| User.prototype.sayHi = function(){ | |
| console.log("HI!!!"); | |
| }; | |
| angular.module('app').constant('User', User); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment