$scope.formData = {};
$http({
        method: 'POST',
        url: '/user/',
        // pass in data as strings
        data: $.param($scope.formData), 
        // set the headers so angular passing info as form data (not request payload)
        headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' } 
    })
    .success(function(data) {
        console.log(data);

        if (!data.success) {
            // if not successful, bind errors to error variables
            $scope.errorName = data.errors.name;
            $scope.errorSuperhero = data.errors.superheroAlias;
        } else {
            // if successful, bind success message to message
            $scope.message = data.message;
        }
    });

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案