Hi I've started to make a comments module for my website with Angular, and I am stucking now at one point: updating my JSON file which contains the comments.
Here is the JSON:
[
{
"page": "dashboard",
"text":"first comment",
"author":"vince"
},
{
"page": "dashboard",
"text":"second comment",
"author":"vince"
},
{
"page": "angular_crawling",
"text":"second comment",
"author":"vince"
}
]
And the function which add comments to the $scope data, but it's not changing the JSON file
$scope.addcommentaire = function() {
console.log(this.textMessage);
console.log(this.auteur);
console.log(document.getElementById('hiddenpage').value);
var onecomment= {page:document.getElementById('hiddenpage').value, text:this.textMessage,author:this.auteur };
$scope.commentaires.unshift(onecomment);
};
how to add data in a JSON file with angular or javascript ? Is it possible?