Im quite new to Angular, so how Im approaching this might be entirely wrong, but some general advice on which direction to take with this would be much appreciated. More or less what I'm trying to do is use Angular to create new "Like" objects (similar to facebook 'likes'). They contain two values, user_id (which used to be set by rails as current_user.id via devise's helper method) and post_id.
My problems:
`
<input type="text" value="<%= current_user.id %>" ng-model="newLike.user_id" >
So more or less what I'm asking is, how could I manage to set default values of the inputs for user_id and post_id. I've come across recommendations for using ng-init, however, from everything I've seen it seems that this only allows setting default input values from the angular controller
EDIT:
It took shockingly long for it to dawn on me to pass the variables in as params to addLike so I've managed to successfully create new objects based off of the current_user.id & act.id.
Rails way You can write inside your .html.erb (or .js.erb) javascript code that initializes a global / passes a parameter with the value of current_user.id
Angular way Using ng-init is perfect here (better over the rails way). As Mark Rajcok commented ng-init can be used from your HTML like this:
<input type="text" ng-init="newLike.user_id='<%= current_user.id %>'" ...>