SyntaxError:AngularJS中位置0的JSON中的意外标记C.

I want to save data to MySQL using AngularJS.But I ran into a problem and did not.Adding data is happening.Also a blank line is added at the same time.Blank line first, then the data. enter image description here

insert.html

<ion-view view-title="Dashboard">
<ion-content class="padding">
<form ng-submit="submit()">
 <div class="list">
   <label class="item item-input">
      <span class="input-label">Name</span>
      <input type="text" ng-model="data.name">
   </label>
   <label class="item item-input">
      <span class="input-label">Surname</span>
      <input type="text" ng-model="data.surname">
    </label>
   <label class="item item-input">
      <span class="input-label">Mail</span>
      <input type="text" ng-model="data.mail">
   </label>
 </div>
   <button class="button button-block button-positive" type="submit"     name="submit" value="Submit to server">
 Register
   </button>
</form>
</ion-content>
</ion-view>

controller.js

angular.module('starter.controllers', [])

.controller('DashCtrl', function($scope,$http) {



 $scope.data = {};


   $scope.submit = function(){      
        $http.post("http://localhost:8080/insert.php", {
            'name' : $scope.data.name,
            'surname': $scope.data.surname,
            'mail' :  $scope.data.mail 
          }).then(function(response){
                console.log("Data Inserted Successfully");
            },function(error){
                alert("Sorry! Data Couldn't be inserted!");
                console.error(error);

            });
    }


 })

insert.php

<?php

 require_once 'conn.php';

 $data = json_decode(file_get_contents("php://input"));
 // Escaping special characters from submitting data & storing in new variables.
$name = mysqli_real_escape_string($conn, $data['name']);
$surname = mysqli_real_escape_string($conn, $data['surname']);
$mail = mysqli_real_escape_string($conn, $data['mail']);


// mysqli insert query
  $query = "INSERT into user (name,surname,mail) VALUES ('$name','$surname','$mail')";
 // Inserting data into database
mysqli_query($conn, $query);
echo true;


?>

I'm waiting for your help

I changed controller.js like this.No blank lines added.enter image description here

but I keep getting the same mistake(SyntaxError: Unexpected token C in JSON at position 0).I still do not understand why :).I solved the problem for now.But the error is still bothering me.I am open to proposals.thanks

controller.js

angular.module('starter.controllers', [])

.controller('DashCtrl', function($scope,$http) {

 $scope.data = {};


$scope.submit = function(){   



$http({
    method: 'POST',
    url: 'http://localhost:8080/kaydet.php',
    data: {
        'name' : $scope.data.name,
        'surname' : $scope.data.surname,
        'mail' : $scope.data.mail

    },
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }

  });
} 

 })

I Have similar error and solved by below changes. May be it will be helpful you.

$http.get(Server.url + "aspirant/aspirantName", {
                transformResponse: function (response)
                {
                    return response;
                }
            }).then(response){}

or

$http.post(Server.url + 'aspirant/attachment/' + localStorage.getItem("broadcastMprId"), fd, {
                transformRequest: angular.identity,
                headers: {'Content-Type': undefined}
            });