jquery - Angular2 - Delete Row Or Column Where the delete button was clicked -
we can delete using jquery, can use angular this?
<tr> <td *ngfor="#lev of rubric?.criteria[0].levels"> <button class="close removelevel" (click)="onclickremove($event)">×</button> <input type="text" class="form-control" placeholder="performance level" #level="ngform" [(ngmodel)]="lev.level" ngcontrol="level" /> </td> </tr>
and in component.ts:
onclickremove($event) { }
how can access row or cell element here, event raised?
from question , want delete row when delete button pressed . in angular way must doing remove record model . pass row id unique ng-controller , remove model.
so if have below
<td *ngfor="#lev of rubric?.criteria[0].levels"> <button class="close removelevel" ng-click="onclickremove($index)">×</button> <input type="text" class="form-control" placeholder="performance level" #level="ngform" [(ngmodel)]="lev.level" ngcontrol="level" /> </td>
in controller
$scope.onclickremove=function(index) { //replace model here rows.splice(index, 1); }
Comments
Post a Comment