How can we transfer data from a modal to a main controller table and update the table on clicking the generate button in the modal? Currently, I am able to retrieve input text data from the generate button click event but the table is not being updated with this data. Access my code on Plunker: https://plnkr.co/edit/yk4Zcl6LF79cw4msYUrw?p=preview
// AngularJS code
var myTable = angular.module('myTable', ['ui.bootstrap']);
myTable.controller('tableCtrl', function($scope, $http, $uibModal) {
$scope.Catalogs = [];
$scope.phNumber = [];
$scope.schema=[{"value":"2.0"},{"value":"2.2"}];
$scope.revision=[{"value":"ARev"},{"value":"XRev"}];
$http({
method: 'GET',
url: 'http://100.96.16.175:8080/CGSDataManager/webapi/component_type',
headers: {'Accept': 'application/json'}
}).success(function(data) {
$scope.components = data;
});
$http({
method: 'GET',
url: 'http://100.96.16.175:8080/CGSDataManager/webapi/platform_info',
headers: {'Accept': 'application/json'}
}).success(function(data) {
$scope.systems = data
for(var i = 0; i < data.length; i++) {
$scope.phNumber = data[i].platform_id;
}
});
$scope.change = function() {
// Modal configuration
var modalInstance = $uibModal.open({
templateUrl: 'modalView1.html',
controller: 'ModalInstanceCtrl',
resolve: { item: function() {
return angular.copy({schema: $scope.schema, revision: $scope.revision, components: $scope.components, systems: $scope.systems, phNumber: $scope.phNumber, Catalogs: $scope.Catalogs});
}}
});
modalInstance.result.then(function(){
// On OK button press
}, function(){
// On cancel button press
console.log("Modal Closed");
});
};
});
myTable.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, item) {
$scope.item = item;
$scope.cancel = function() {
$uibModalInstance.dismiss('cancel');
};
$scope.submitData = function() {
$scope.item.Catalogs.push({name: $scope.catalogName, validation: "true", publishing: "hello"});
$uibModalInstance.dismiss('submit');
};
});
// HTML and CSS code can be found in the Plunker link provided.