I have a form as given below:
<form name="my-test-suite" ng-submit=submit() ng-controller="createTestSuite">
<div ng-controller="showTests">
<div class="container">
<table class="table table-striped">
<thead>
<tr>
<th>Select Test</th>
<th>Test ID#</th>
<th>Description</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="test in testcases">
<td>
<input ng-model='ctrl.test.selected' type="checkbox" value="">
</td>
<td ng-model='test.id' >{{ test.id }}</td>
<td ng-model='test.resourceId'>{{ test.resourceId }}</td>
<td ng-model='test.allGraphs'>{{ test.allGraphs }}</td>
</tr>
</tbody>
</table>
</div>
<div align=center>
<button class="btn btn-default" type="submit">Submit</button>
</div>
</div>
</form>
and controllers as:
var app = angular.module('myApp', []);
app.controller('showTests', function($scope, $http) {
$http.get("http://localhost:4567/config-manager/tests").then(
function(response) {
$scope.testcases = response.data;
});
});
app.controller('createTestSuite', ['$scope', function($scope, $http) {
$scope.submit = function() {
console.log($scope.test);
};
}]);
It shows the grid properly with showTests but when I want to see the table data using createTestSuite Controller I cant see $scope at all. This is the problem. I want to read entire table data and use with post request. Please help.
One got below json for get request:
[ {
"id" : 55,
"allGraphs" : null,
"resourceId" : "126"
}, {
"id" : 56,
"allGraphs" : null,
"resourceId" : "125"
}, {
"id" : 58,
"allGraphs" : null,
"resourceId" : "140"
} ]