Hi Cédric, I can't see any reason why the names would be a problem. I tend 
to keep the naming the same between the UI and the Storage to help keep it 
simple.

One word of advice is to create services to get/set data from the REST API. 
This will allow you to abstract the inner working, share data across 
different controllers and cache common data.
Personally if you want the naming of the properties to be more friendly I 
would change them on the REST Server and leave the JS code as clean as 
possible. If this is not possible then you can create DTO's within the 
Service (not recommended) and I am sure there are a few Mapper libs out 
there.

Regards,

Garry Taylor

On Monday, 19 May 2014 01:44:57 UTC+1, Cédric FIEGE wrote:
>
> Hi,
>
> I'm working on an angular app with data coming from a REST API.
> The REST API sends a JSON for each resource and the data in the JSON is 
> very specificly named (like Uid, ULKlogin, ...).
> Since a model layer is meant to be easily changeable, i think there is 
> something wrong in binding data with such specific names directly in view.
>
> What are the best practices concerning this problem and the model layer in 
> general ?
>
> Currently, I'm using $resource directly in the controller and binding the 
> result to the scope.
> When there is a form, I'm just sending back the same object in the $scope 
> (with user modifications included) to the API.
>
> What are the best practices for forms ?
> Is it better to copy, and 'translate' the JSON from the API to something 
> more generic and then 'untranslate' it before sending it back to the API ?
>
> Thanks !
>

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