Anuj Mayank Anuj Mayank - 4 months ago 9
AngularJS Question

How to read data from a table and form an array and post it?

I want to get data and display it on a table then modify the "availability" and again post it to the server by forming an array of object. Right now the way I am doing it I am able to get the data but it is not coming with modification .

<!DOCTYPE html>

<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<script src="//"></script>

<body ng-app="valueExample" ng-controller="ExampleController">
angular.module('valueExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.routeDetails =
"Employee":"Employee 1",
"Employee":"Employee 2",
"Employee":"Employee 3",
"Employee":"Employee 4",
$scope.submit = function(data) {
<table class="table_role" >
<tr><th>Employee Name</th>
<!-- <th>Date</th> -->
<tbody ng-repeat="routeDetail in routeDetails | orderBy">

<!-- <td>{{}}</td> -->

<input type="checkbox" ng-checked="routeDetail.availablity == 'Yes'" />
<button ng-click="submit(routeDetails)" type="submit">Submit</button>



Change your checkbox logic like this

    <input type="checkbox" ng-model="routeDetail.availablity"
                   ng-true-value="'Yes'" ng-false-value="'No'"/>

It should work.