// This is my Component.ts
// How can i add a new row for this table with new Values.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-uom',
templateUrl: './uom.component.html',
styleUrls: ['./uom.component.css']
})
export class UomComponent implements OnInit {
itemIdVal: '';
itemDescVal = '';
itemClassval = '';
itemSubClassVal = '';
show: boolean;
constructor() { }
ngOnInit() {
}
addRec() {
// alert(this.itemIdVal + '|| ' + this.itemDescVal + '|| ' + this.itemClassval + '|| ' + this.itemSubClassVal);
}
}
<!--This is my Component.html -->
<table style="width:100%;">
<thead>
<tr>
<td><input type="text" placeholder="Please Enter Item ID" [(ngModel)] = "itemIdVal"/></td>
<td><input type="text" placeholder="Please Enter Item Description" [(ngModel)]="itemDescVal"/></td>
<td><input type="text" placeholder=" Please Enter Classification" [(ngModel)]="itemClassval"/></td>
<td><input type="text" placeholder="Please Enter Sub-Class" [(ngModel)]="itemSubClassVal"/></td>
</tr>
<tr height="25">
<th width="25%">Item ID</th>
<th width="25%">Item Description</th>
<th width="25%">Item Classification</th>
<th>Item Sub-Classification <span class="buttons"><a (click)="addRec()"><span>Add Record</span></a></span></th>
</tr>
<tr>
<td>{{itemIdVal}}</td>
<td>{{itemDescVal}}</td>
<td>{{itemClassval}}</td>
<td>{{itemSubClassVal}}</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
答案 0 :(得分:0)