angularjs - Angular & jsonStub post -


so using online tool fake backend creating json , restful services, although know how create one.

but company applied job requires, crud app jsonstub.

it works great request can fetch data, , everything.

but when try, post, doesn't work.

the json file stays unchanged.

maybe code problem ?

any appreciated in advance

$http({     url: 'http://jsonstub.com/nemke/test',     method: 'put',     datatype: 'json',      data: {     first_name:$scope.newuser.name,     last_name:$scope.newuser.last_name,     cv_file_name:$scope.newuser.cv.name,         },              headers: {         'content-type': 'application/json',      'content-type': 'application/x-www-form-urlencoded',         'jsonstub-user-key': '9de0ebf1-494e-49db-bae5-7efbbf3d0b25',         'jsonstub-project-key': '1d5a1cd7-33fa-4838-918b-e11d9fd75081'     } }).then(function (data, status, headers, config) {     data = 'asfsa'; console.log(json.stringify(data, null, 4)); }); 

here html

<form ng-model="newuser" method="post" enctype="multipart/form-data"> <input type="text" id="first_name" name="name" placeholder="first_name" ng-model="newuser.name"> <input type="text" id="last_name" name="last_name" placeholder="first_name" ng-model="newuser.last_name"> <input type="file" id="cv" name="cv" placeholder="cv" fileread="newuser.cv"> <input type="submit" ng-model="submit" value="submit"> </form> 

i think should try it

$scope.newuser={}; $http({     url: 'http://jsonstub.com/nemke/test',     method: 'put',     datatype: 'json',      data:$.param($scope.newuser), ///  }     

and see in input cv dont have ng-model , try add this

 <input type="file" id="cv" name="cv" placeholder="cv" fileread="newuser.cv" ng-model="newuser.cv> 

Comments