我有一个问题,是否可以将数据添加到本地JSON文件,我尝试使用此代码:
Controller.js:
$scope.creerOperation= function(article) {
article.codeOperation = $scope.articleCourante.codeOperation;
article.operation = $scope.articleCourante.operation;
$http
.post("./json/Options/create.json",article)
.success(
function(newArticle) {$scope.annulerAjout();});}
MyView.html:
<div class="form-group">
<input class="form-control" ng-model="articleCourante.codeOperation" />
<input class="form-control" ng-model="articleCourante.operation" />
<button ng-click="creerOperation(articleCourante)">Add</button>
</div>
create.json:
{
"codeOperation": "codeOperation1",
"operation": "operation1",
}
但是我输入文本中的任何数据都没有添加到create.json文件中 请帮忙,我怎样才能纠正我的代码呢? 谢谢你的帮助