Code Style with Rails API

14 views
Skip to first unread message

César Costa

unread,
Sep 29, 2014, 9:16:35 AM9/29/14
to ang...@googlegroups.com
Hello,

I am using AngularJS with rails as backend. So, in AngularJS i am using the suggested code style for object attributes, in camelcase way with first letter lower case, like:

user = {
  phoneNumber: '93939393'
}

but, when i receive this object from rails api, the pattern is

user = {
  phone_number: '93939393'
}

The code on front end getting confused. How can i solve this problem?

Thanks :)

Sander Elias

unread,
Sep 29, 2014, 10:01:58 AM9/29/14
to ang...@googlegroups.com
Hi César,

The code style is for directives and html-attributes. It is maybe a bit cleaner if you use
it for your data-properties too. But in your case, I would simply just use the underscored
property names. There is no issue with those in angular.

Regards
Sander

César Barone

unread,
Sep 29, 2014, 10:26:28 AM9/29/14
to ang...@googlegroups.com
Thanks, Sander :).



--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/ofPG5DNTw2M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages