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)">&times;</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)">&times;</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

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -