1

I want to get check box value that was created dynamically, I have searched about this but I didn't get any solution

<div ng-app="formListApp" ng-controller="formListController">
<form action="post" class="ng-pristine ng-valid">
    <button class="md-raised" type="button" ng-transclude="" ng-click="applyTemplate()">Allpy Template</button>
    <table>
        <tr id="header" class="header_row_hed">
            <td id="sl_no" class="sl_no_col_hed">Sl.No</td>
            <td id="chk_box" class="chk_box_col_hed">
                <input name="select_all" id="selectAll" class="" style="" ng-model="all" type="checkbox">
                Select All
            </td>
            <td id="form_name" class="form_name_col_hed">Form Name</td>
            <td id="template_name" class="template_name_col_hed">Applied template</td>
        </tr>
        <?php
          $slNo = 1;
          foreach ( $form_list as $form_lists ) {

            <tr id="form-<?php echo $form_lists['id']; ?>" class="header_row">
                <td id="<?php echo $slNo; ?>" class="sl_no_col"><?php echo $slNo; ?></td>
                <td id="chk-box-<?php echo $form_lists['id']; ?>" class="sl_no_col_hed">
                    <input name="select_all" id="selectAll-<?php echo $form_lists['id']; ?>" class="" style=""
                           ng-checked="all" ng-model="formId<?php echo $slNo; ?>" type="checkbox"
                           val="<?php echo $form_lists['id']; ?>">
                </td>
                <td id="form-id-<?php echo $form_lists['id']; ?>"
                    class="form_name_col"><?php echo $form_lists['name']; ?></td>
                <td class="template_name_col"></td>
            </tr>
        <?php } ?>
    </table>
</form>
</div>

<script>
var myAdminApp = angular.module('formListApp');

myAdminApp.controller('formListController', function AdminController($scope) {
    $scope.formId = {};

    $scope.applyTemplate = function () {

    }
});
</script>

this is my code I'm new to angular is it possible to get check box value?

5
  • refer to this link: stackoverflow.com/questions/12579986/… Commented Sep 22, 2017 at 11:18
  • i am using database to fetch value for check box, i cant store value in anguler Commented Sep 22, 2017 at 11:31
  • ng-model is used to store the value in angular. in your code your storing the ng-model with "formId<?php echo $slNo; ?>". other wise you have to fetch the checkbox value with the help of id. ex: document.getElementById('#id').checked Commented Sep 22, 2017 at 11:34
  • that is javasript, it means using ng-model it was not possible? anyway thanks for solution. Commented Sep 22, 2017 at 11:40
  • using ng-model u have to assign the ng-modal with data instead of id. then u can fetch the value. Commented Sep 22, 2017 at 11:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.