Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS提交json_Json_Angularjs - Fatal编程技术网

AngularJS提交json

AngularJS提交json,json,angularjs,Json,Angularjs,这是一个带有angularjs的表单 名字: 姓氏: 重置 表单={{user}} 函数formController($scope){ $scope.master={firstName:“John”,lastName:“Doe”}; $scope.reset=函数(){ $scope.user=angular.copy($scope.master); }; $scope.reset(); } 您可以使用$http将您的模式(本例中的用户)直接发布为JSON 如果您所有的文本字段都保存在用

这是一个带有angularjs的表单


名字:

姓氏:


重置 表单={{user}}

函数formController($scope){ $scope.master={firstName:“John”,lastName:“Doe”}; $scope.reset=函数(){ $scope.user=angular.copy($scope.master); }; $scope.reset(); }
您可以使用$http将您的模式(本例中的用户)直接发布为JSON

如果您所有的文本字段都保存在用户模式中,那么您可以在提交表单之前通过调用下面的函数删除其中一个属性

    $scope.remove = function (user) {
    delete $scope.user.firstName;//the output here is user with only lastname
    }