I have an HTML table with many rows in it and want to hide a row when the user clicks the delete button for that particular row. I'm having trouble doing it with Angular and the ng-hide
directive.
Here's my (simplified) HTML code for just two rows:
<tr ng-hide="isRowHidden">
<td>Example template title</td>
<td>
<a href="#" ng-click="deleteTemplate(@template.id)">Delete template</a>
</td>
</tr>
<tr ng-hide="isRowHidden">
<td>Another example template title</td>
<td>
<a href="#" ng-click="deleteTemplate(@template.id)">Delete template</a>
</td>
</tr>
And here is my Angular code (in CoffeeScript) thus far:
$scope.deleteTemplate = (templateId) ->
console.log "Deleting template id #{templateId}"
$scope.isRowHidden = true
I know that the last line is incorrect because it hides all rows instead of just one. What am I missing? Thanks!