Search code examples
pug

How to take value of a checkbox as 1 for checked box in jade


I am using jade in which I have a checkbox in my code. When user selects a checkbox then value is send as true to the server instead of 1 while for unchecked boxes value is sent as 0. How can I pass value of checkbox as 1 when user checks the checkbox.

input.form-control(type="checkbox", name="compare_form_required", id="compare_form_required", ng-model="program.compareFormRequired")


Solution

  • I Used ng-true-value="1" that sets the value as 1 on check of a checkbox So I have used it this way :

    input.form-control(type="checkbox", name="compare_form_required", id="compare_form_required", ng-model="program.compareFormRequired", ng-true-value="1")