I'm having a problem figuring out how to add an ng-keyup to a rails text_field helper used with form_for. This <%#= f.text_field :email, ngkeyup: "checkEmail()" %>
comes close but adding the dash in ngkeyup causes it to error out and trying to make it a string doesn't work.
I have (but this is obviously not working):
<%= form_for @user do |f| %>
<%#= f.text_field :email %>
<%#= f.text_field :email, options: {ng-keyup:"checkEmail()"} %>
<%#= f.text_field :email, {ng-keyup:"checkEmail()"} %>
<%#= f.text_field :email, ng-keyup:"checkEmail()" %>
<%= f.text_field :email,,ng-keyup:"checkEmail()" %>
<div id='email-status'></div>
<% end %>
and would like
<input id="user_email" name="user[email]" size="30" type="text" ng-keyup="checkEmail()">
I really just need to get the ng-keyup value in here.
thx for any help
Running rails 4.0.1 this did the trick for me:
<%= f.text_field :email, "ng-keyup" => "checkEmail()" %>
There are many other cases in which Rails won't accept any other key-value syntax expect the one with the hashrocket.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.