I'm not sure if I understand all your objectives.

If you want to have a couple of additional fields, that you do not save 
back to the server a pragmatic option is 
* to just use a prefix for your fields
* filter out fields with that prefix using $httpProvider:
  $httpProvider.defaults.transformRequest.unshift(yourCleanupFunction);

Of course, if you are lazy, you can just use "$$" as prefix, which will be 
automatically filtered out by angular (if you use $http to post to the 
server).
But that isn't recommended, because your names might clash with angular's 
own ones.


On Monday, September 29, 2014 8:45:56 AM UTC+2, system wrote:
>
> Hello
> What would be the good way to share model in application?
>
> There is list of objects from server. These objects should be:
> a) Displayed in views (different states). Sometimes I need to add data to 
> these objects. E.g. 'disabled', so it could be displayed properly; 'name', 
> that come from other objects based on ID,; etc.
> b) Modify object on view (without saving to backend) and revert back.
> c) Save to backend (PUT/POST).
>
> I know several ways to solve it:
> 1. For each object type create "model", that have defined list of fields 
> and their types. So when i do put/post i could exclude all other extra 
> fields.
> 2. Create copy of list for each view(controller), and then update that 
> list when data updated froms server (e.g. using watch).
>
> What option is better, and are there any other options?
>

-- 
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