title: Unexpected token T in JSON at position 0
body: <p>I am getting this error in console when i click submit button though my data is getting saved to backend as i wanted.</p>
  
  <pre><code>SyntaxError: Unexpected token T in JSON at position 0
      at JSON.parse (&lt;anonymous&gt;)
      at dc (angular.min.js:91)
      at angular.min.js:92
      at q (angular.min.js:7)
      at gd (angular.min.js:92)
      at f (angular.min.js:94)
      at angular.min.js:131
      at m.$digest (angular.min.js:142)
      at m.$apply (angular.min.js:146)
      at l (angular.min.js:97)
  </code></pre>
  
  <p>Here is my frontend code in angular </p>
  
  <pre><code>  $scope.nextStep = function() {
          if ($scope.selection === 'Information'){
              $scope.branch.organisation = $scope.branch.organisation.id;
              $scope.fact.incrementStep($scope);
          }
          else if ($scope.selection === 'Validation'){
              var authdata = base64.encode($rootScope.globals.currentUser.user.phone + ':' + $scope.password.password);
              if (authdata === $rootScope.globals.currentUser.authdata){
                  $scope.passwordMatch = true;
  
                  var branchArr = [];
                  var dynamicBranches = $scope.dynamicBranches;
  
                  for (var i = 0; i &lt; dynamicBranches.length; i++) {
                    branchArr.push(dynamicBranches[i].name);
                  }
  
                  var params = [{
                      "region" : $scope.branch.region,
                      "branches" : branchArr
                  }];
  
                  Restangular.one('organisation', $scope.branch.organisation).all('add_region_and_branch_data').post(params).then(function(response) {
                       $scope.createdBranch = response;
                       $scope.fact.incrementStep($scope);
                   }, function(error){
                       ///console.log('Error with status', error.statusText, 'code', error.status);
                       //SweetAlert.swal('Error', 'The agent couldn\'t be created. \n' + error.data.error, 'error');
                       console.log(error);
                   });
  
  
              }else{
                  $scope.passwordMatch = false;
              }
          }
      };
  </code></pre>
  
  <p>Again, my data is getting saved to api but I am getting this error. How can i fix this?</p>