xxxxxxxxxx
//ADDING NEW COMMENTS
//add new comment within project
$scope.addnewcomment = function() {
$scope.projectDetails.Comments.push({
"Author": "test",
"Text": $scope.NewComment
})
}
xxxxxxxxxx
//ADDING NEW COMMENTS
//add new comment within project
$scope.updatecomments = undefined;
$scope.addnewcomment = function() {
$scope.updatecomments = $scope.updatecomments || $scope.projectDetails.Comments;
$scope.updatecomments.push({
"Author": "test",
"Text": $scope.NewComment
})
}
xxxxxxxxxx
$scope.combineComments = function (){
var jsonStr = $scope.projectDetails.Comments;
var obj = JSON.parse(jsonStr);
obj.push({"Author":"Test","Text":$scope.NewComment});
jsonStr = JSON.stringify(obj);
}
}
xxxxxxxxxx
<?php
$json1 = '{
"id": "#001",
"username": "Tom",
"type": "admin",
"status": "active"
}';
$json2 = '{
"id": "#002",
"username": "Jerry",
"type": "user",
"status": "Inactive"
}';
$user[] = json_decode($json1, true);
$user[] = json_decode($json2, true);
$json_merge = json_encode($user);
?>