There are a couple of checkboxes and a button. When i press the button need to know which all checkboxes are selected in the controller.
I have a controller
Mcontroller
where i have $scope.selected_machines = {}
html file have the checkboxes created dynamically
<tr ng-repeat="(m, res) in results.byMachine">
<td> {{ m }}
<input type="checkbox" id ="{{ m }}" name="bypass_check"
ng-disabled="disableBypassWaitForDrainedCheck(m, results.bypassed_machines)"
ng-model="selected_machines[m]">
</td>
the html file is called using a directive
.directive('visualizer', [$window, function ($window) {
return {
restrict: 'E',
scope: {
selected: '<selected',
},
templateUrl: 'static/html/ng/visualizer.html',
link: function (scope, element, attrs) {
scope.data = {}
scope.pollers = {}
scope.rendered = {}
scope.table = {}
.........
The buttons click function is bypassWaitForDrained()
function called from an angular service file and is defined in the controller Mcontroller
.
I need to access the checked checkboxes from this function. Tried following and the value in selected_machines are never updated. Basically the ngModel
selected_machines
data is not getting updated in the controller. May i know what could be the reason ?
$scope.bypassWaitForDrained = function(pipelineId) {
Loop through selected_machines
}