1

Hi I have a table in a html.erb file

<tr ng-repeat="record in TableContent">
    <td>{{record.name}}</td>
    <td>{{record.directory}}</td>
    <td>{{record.creation_date}}</td>
    <td>{{record.updated_date}}</td>
    <td><%= render :partial => '/table_content/entry_actions',
                   :local => {:entry => record } %>
    </td>
</tr>

It is possible for me to use the Angular record variable into the :local field of Rails render tag?

Thanks in advance!

1
  • 2
    You have to understand that the ruby code is executed on the server's side whereas the javascript is executed on the client's side. The ruby code is interpreted at a different level than the Javascript code. Commented Apr 21, 2015 at 14:58

1 Answer 1

2

No, record should be a javascript variable and will raise an exception here as record is not defined, only if you have the data in the backend as a ruby variable you can pass to it as render will be evaluated in the backend,

if you want to achieve that, i suggest to have this partial as a template and render it from client side with Angular.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I will try your suggestion. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.