I have this code:
<tr ng-repeat="doc in providers">
<td><input type="checkbox" ng-true-value="{{doc.provider.Id}}" ng-false-value="" ng-model="ids"></td>
</tr>
{{ids}}
i want to get the values of the checkboxes on an array
You should save your checkbox by the position of the current title, right now your code is to push the boolean into the array, which couldn't tell you what value it stand for actually. Whenever you select the checkbox, we just simply reverse its value in the array.
directive('checkList', function() { return { scope: { list: '=checkList', value: '@' }, link: function(scope, elem, attrs) { var handler = function(setup) { var checked = elem. prop('checked'); var index = scope. list. indexOf(scope.
You need to do the following: $check = isset($_POST['check']) ? $_POST['check'] : ''; $check_msg = is_array($check) ? implode(", ", $check) : ''; $body = "F-Name: ".
ng-true-value
only accepts strings so you'll need to use a workaround. This has been a feature request for some time. In the meantime, you can do this:
Create an ids
object in the controller like:
$scope.ids = {};
and change ng-model
to reference a key in that object. You can use the default true/false
checkbox values:
<td><input type="checkbox" ng-model="ids[doc.provider.Id]"></td>
Then you can loop over the keys in ids
checking for true
.
Here is a fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With