Is `full_name` an attribute of a `User` or is it a method called on a `User`? Those are two very different things. If `full_name` is a model on the `User` model in Rails, then you can't access it from Angular, nor should you be able to.
On the other hand, if a `User` object has a `full_name` attribute, then I don't see why that code wouldn't work. On Thu, Jan 23, 2014 at 10:54 PM, S <[email protected]> wrote: > Hi, thanks for the reply. Actually i am searching for an example of > angularjs rails where we can access the data which we get by join on tables > in rails as i am trying to show the data associated between two tables by > angularjs. Currently i am able to iterate over one table and getting the > corresponding values but i would like to know the syntax to get the data > which we get by join on the two tables. If u could send some example where > this kind of table join is done in angularjs it would be helpful. > for example in index.html page for angularjs : > here bets in the table > <tr ng-show="bets.length != 0 " ng-repeat="bet in bets"> > <p style="" title="{{bet.description}}"> > </p> > </td> > <td>{{bet.bet_owner.full_name}}</td> # this line does not evaluates bet > owner(has-one in bet table) fullname(fullname method in user table) > <div ng-show="bet.bet_owner.id==current_user.id">aaa</div> # > this line does evaluates and shows the content aaa > > i want to know how to write this line <td>{{bet.bet_owner.full_name}}</td> > in angularjs so that i can get fullname which is associated between two > tables bet and user by id. > > Thanks > > On Thursday, January 23, 2014 11:49:30 PM UTC+5:30, James Brewer wrote: > >> If I understand correctly, then what you're wanting to do is access >> related data. For example, if you request a `Teacher` object which `has_one >> School`, then you want to be able to access data about the school. >> >> Your API call should return this information, but perhaps you are >> concerned that you are making too many database calls? If so, the solution >> you're looking for is Active Record's `include`. See here: http://guides. >> rubyonrails.org/active_record_querying.html#eager-loading-associations >> >> >> On Thu, Jan 23, 2014 at 8:24 AM, Sheetal Sharma < >> [email protected]> wrote: >> >>> We are using rails at back end and angularjs on front end for an >>> application. In rails we are using joins on tables for example id on one >>> table corresponds to id in another table(has-one relationship in rails). Is >>> there a way in angularjs by which we can access the data which we get by >>> join on tables? currently we can only get the individual table data using >>> json api call. if any example in angularjs corresponding to the above >>> problem could be found please do post it. >>> >>> >>> 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/groups/opt_out. >>> >> >> -- > 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/groups/opt_out. > -- 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/groups/opt_out.
