I'm facing an issue with my code that involves using a $uibModal popup to add a new record. Despite passing the scope object into the function to save it, I keep getting 'undefined' as the result. Below is the code snippet along with the [plunker] (http://plnkr.co/edit/WXKCyzlfJFCA3FB7S2pa?p=preview) link.
$scope.userList=[];
$scope.addUser = function(){
$uibModal.open({
templateUrl: 'userData.html',
controller: 'MainCtrl'
});
};
$scope.addNewUser=function(user){
console.log(user);
$scope.userList.push({
'id': user.id,
'name': user.name,
'age': user.age,
'gender': user.gender
});
$scope.clearUserArea(user);
};
$scope.clearUserArea = function(user){
console.log(user);
user.id='';
user.name='';
user.age='';
user.gender='';
};
If anyone could help me pinpoint where I might be going wrong in this code, that would be greatly appreciated. Also, feel free to check out my plunker link for more details on this.