title: Post data to server angular $http post
body: <pre><code>[
      {
          "name": "AAAAAA",
          "date": "28-03-2016",
      },
      {
          "name": "BBBBBB",
          "date": "20-12-2016",
      },
      {
          "name": "CCCCCC",
          "date": "09-01-2016",
      },
      {
          "name": "DDDDDD",
          "date": "21-07-2016",
      }
  ]
  </code></pre>
  
  <p>My javascript:</p>
  
  <pre><code>var app = angular.module('app', []);
      app.service('service', function($http, $q){
          var deferred = $q.defer();
  
          $http.get('names.json').then(function(data){
              deferred.resolve(data);
          });
  
          this.getNames = function() {
              return deferred.promise;
          }
      });
      app.controller('FirstCtrl', function($scope, service, $http) {
          var promise = service.getNames();
          promise.then(function (data) {
              $scope.names = data.data;
              console.log($scope.names);
          }
      );
      $scope.postfunction = function(data) {
           $http({
                      method: 'POST',
                      url: 'serwerUrl' ,
                      data: {"name":$scope.name},
                      headers: {'Content-Type': 'application/x-www-form-urlencoded'}
              })
                  .success(function(data){
                      console.log('data success');
                  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;tbody&gt;
      &lt;tr ng-repeat="name in names"&gt;
          &lt;td&gt;{{name.name}}&lt;/td&gt;
          &lt;td&gt;{{name.date}}&lt;/td&gt;
          &lt;td&gt;&lt;button ng-click="postfunction(names)"&gt;POST&lt;/button&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>What I want do is when I click the button "POST" name.name post to server. I try function postfunction(), but it didn't post to server, in my console everything is ok, but name.name don't post to server.</p>