title: Get value in a row on click and pass it to popup
body: <p>I need to get the value in a row of a table on click and display it in popup</p>
  
  <p>HTML: </p>
  
  <pre><code>&lt;md-data-table-container&gt;
      &lt;table md-data-table class="md-primary" md-progress="deferred"&gt;
          &lt;thead md-order="query.order" md-trigger="onorderchange"&gt;
              &lt;tr&gt;
                  &lt;th name="Task To Be Done"&gt;&lt;/th&gt;
                  &lt;th name="Office"&gt;&lt;/th&gt;
                  &lt;th name="Due Date"&gt;&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody ng-click="showAlert($event)"&gt;
              &lt;tr ng-repeat="dessert in desserts.data" ng-click="showAlert($index)" flex-sm="100" flex-md="100" flex-gt-md="auto"&gt;
                  &lt;td&gt;{{dessert.task}}&lt;/td&gt;
                  &lt;td&gt;&lt;/td&gt;
                  &lt;td&gt;{{dessert.due_on}}&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/md-data-table-container&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>$scope.desserts = {
      "count": 6,
      "data": [{
          "task": "Frozen yogurt",
          "type": "Ice cream"
      }, {
          "task": "Ice cream sandwich",
          "type": "Ice cream"
      }, {
          "task": "Eclair",
          "type": "Pastry"
      }, {
          "task": "Cupcake",
          "type": "Pastry"
      }, {
          "task": "Jelly bean",
          "type": "Candy"
      }, {
          "task": "Lollipop",
          "type": "Candy"
      }, {
          "task": "Honeycomb",
          "type": "Other"
      }]
  };
  $scope.showAlert = function (index) {
      $scope.obj = $scope.desserts.data[2];
      $scope.task = $scope.obj.task;
      alert($scope.task);
      console.log($scope.task);
  };
  </code></pre>
  
  <p>issue in my code is that i could get the value on the array which i have specified ".data[2]". Actually when i click a row in my table i need that value to be displayed to popup "sweetAlert". is there any solution</p>