AngularJS options with a simple_form checkbox

150 views
Skip to first unread message

bertly_the_coder

unread,
Mar 16, 2014, 9:10:55 AM3/16/14
to ang...@googlegroups.com
Hi guys,

I'm using AngularJS with Rails nd simple_form and would like to know how one assigns ng-model to a checkbox in simple_form? I have tried adding it like this:

=f.input :super_admin , label: false, checked_value: true, unchecked_value: false, as: :boolean,:input_html=>{"ng-model"=>"superadmincbx"}

but my ng-hide does not work.
 
%span{"ng-hide"=>"superadmincbx"}

I'm also using the Batarang and checking/unchecking the checkbox does not trigger the corresponding changes in the scoped item. However, in my controller, if I add
 
$scope.superadmincbx = true;

it get's picked up by the checkbox(it's checked) and ng-hide works. What am I not seeing/doing wrong? I also have a drop-down select which works as expected when I use:

=f.association :survey_type, as: :select,:input_html =>{"ng-model"=>"survey_type"} which works fine.

Thanks for your help!

Luke Kende

unread,
Mar 17, 2014, 2:40:14 AM3/17/14
to ang...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages