Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loadProducts(){
- if ($.fn.DataTable.isDataTable(this.Table.nativeElement) ) {
- $(this.Table.nativeElement).dataTable().fnDestroy();
- }
- this.crudService.getProducts().subscribe(
- productData => {
- this.products = productData;
- this.dataTable = $(this.Table.nativeElement);
- setTimeout(()=>{
- this.dataTable.DataTable();
- }, 2000);
- },(err)=>{
- }, ()=>{
- }
- );
- }
- deleteProduct(pID) {
- this.crudService.deleteProduct(pID).subscribe(data => {
- this.loadProducts();
- })
- }
- }
- <button type="button" class="btn btn-danger" (click)="deleteProduct(product.p_id)">Delete</button>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement