check this out: 
 http://blog.shinetech.com/2014/02/04/rich-object-models-and-angular-js/  

restangular includes a method called extendModel that lets us decorate 
> models returned from particular routes with additional behaviour.
>

ExendModel will allow you to decorate your User model with whatever custom 
attributes that aren't on the server.

On Thursday, April 3, 2014 3:20:20 PM UTC-4, Magnus Lassi wrote:
>
> Hi, I've started using Restangular and I really like it when communicating 
> to a REST backend. I have a case which I'm unclear on if it can help me 
> with. I have a UserModel which is part of my model layer. It may have 
> custom attributes that the server doesn't have in it's model and also 
> behavior. I'm not clear if I'm able to use my custom User model, send it to 
> the backend and when it returns transform it back to the UserModel object 
> of my model layer so I still have the custom attribute and methods.
>
> Here's the plunker: http://plnkr.co/edit/IlYcSRuX3GPWmewxniuq?p=preview
>
> Where do I handle the transformation? Do I add the methods in the config 
> block or should I add it via adding a response interceptor? What about 
> custom attributes that the server might not send back to me? I haven't run 
> across any good examples of this.
>
> The UserInfoCntrl controller sends the UserModel object into the 
> contactInformationService in my example.
>
> Thanks,
> Magnus
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to