title: Getting data attribute in angular
body: <p>I am trying to get the data attribute from this:</p>
  
  <p><code>&lt;button ng-click="EditPlayer(name, position, number, age)" id="btnEdit" class="btn btn-successes" data-playerid="{{player.id}}"&gt;Save&lt;/button&gt;</code></p>
  
  <p>In my angular controller I have:</p>
  
  <pre><code>$scope.EditPlayer = function(name, position, number, age) {
  
      var player_id = $(this).data('playerid');
  
      console.log(player_id);
  
      var player = new Player(name, position, number, age);
  
      $http({
          method : "PUT",
          url : 'api.php/players/'+player_id,
          data: JSON.stringify(player),
      }).then(function mySucces(player) {
          $scope.players.push(player);
      }, function myError(response) {
          $scope.showError = response.statusText;
      });
  };
  </code></pre>
  
  <p>I need to get the attribute so I can target each player_id for an update (PUT request). The problem is that <code>$(this).data(player_id)</code> is returning undefined. </p>