I am trying to update the details of a specific user and it keeps giving me the error that memberID is not defined in the script. What should I write instead? Already tried memb and still gave me the same error. Thanks for the help
Members.controller('editMembers',['$scope','$http','$routeParams',function($scope, $http,$routeParams){
var id=$routeParams.id;
console.log(id);
$scope.updateMember="";
//populating data with exsisting member details
$http.post('PHP/getMemberByID.php',{'id':id}).success(function(data){
$scope.memb=data;
console.log(data);
});
$scope.updateMember = function(project) {
$http.post('PHP/editMembers.php/'+id, memberID).success(function(data) {
if (data) {//row updated
console.log("Succesful Update");
} else {
console.log("Unsuccesful Update");
}
});
};
}]);
Pass the memberID in the function in place of project
$scope.updateMember = function(memberID) {
$http.post('PHP/editMembers.php/'+id, memberID).success(function(data) {
if (data) {//row updated
console.log("Succesful Update");
}
else {
console.log("Unsuccesful Update");
}
});
};
or if the memberID is in the project collection then do like
$scope.updateMember = function(project) {
$http.post('PHP/editMembers.php/'+id, project.memberID).success(function(data) {
if (data) {//row updated
console.log("Succesful Update");
}
else {
console.log("Unsuccesful Update");
}
});
};