Pass Devise User To AngularJS

Posted By Weston Ganger

I wanted to pass the current_user in devise to my angular app. I'm not sure that this is best practice but it works.

<code class="language-markup">
<% if current_user %>
var current_user = <%= raw current_user.to_json %>
<% end %>

Related External Links:

- [Stack Overflow - Integration of angularjs with rails devise authentication](

Article Topic:Software Development - Javascript

Date:July 07, 2015