ruby on rails - How AngularJS returned value convert to integer? -
i using nested form , angularjs, , have on code.
#app/view/customer_templates/edit.html.erb <%= f.simple_fields_for :customer_template, @customer.customer_template.build, child_index: '{{$index}}' |t| %> <%= t.select :field_type_id, options_from_collection_for_select(fieldtype.all, :id, :name, '{{customer_template.field_type_id}}') %> <% end %>
my select working not getting current data of field_type_id
.
{{customer_template.field_type_id}}
angular, returning right data string, when tried convert integer {{customer_template.field_type_id}}.to_i
, result 0. tried pass variable , converted it, getting same result.
i tried {{parseint(customer_template.field_type_id)}}
, , in angularjs $scope.parseint = parseint
have no luck.
this problem, below.
i must have 1-checkbox, 2-dropdown (yes/no), , 2-textbox, can me this? noob in angularjs. problem value, put inside options_from_collection_for_select
. if can put integer, working.
have tried short hand conversion in javascript?
{{+customer_template.field_type_id}}
and in controller this:
$scope.parseint = +parseint;
Comments
Post a Comment