0

I am using Angular 8 where I am facing error - -> ERROR in customer component **Cannot find module 'async_hooks'.**

ERROR in src/app/customer/customer.component.ts:7:27 - error TS2307: Cannot find module 'async_hooks'.

7 import { currentId } from 'async_hooks';

I tried to search on google about this error, But suggestions show the error is more related to Node Well I tried to import { currentId } from 'async_hooks'; in my module but still showing same error

Just wanted to inform the I am using Angular material table https://material.angular.io/components/table/overview

I am sharing my customer.component.ts have a look on it

import { Component, OnInit, ViewChild } from '@angular/core';
import { CustomerService } from '../_service/customer/customer.service';
import {MatTableDataSource} from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator';
import { MatSort } from '@angular/material';
import { trigger, state, transition, style, animate } from '@angular/animations';
import { currentId } from 'async_hooks';


@Component({
  selector: 'app-customer',
  templateUrl: './customer.component.html',
  styleUrls: ['./customer.component.scss'],
  animations: [
    trigger('detailExpand', [
      state('collapsed', style({height: '0px', minHeight: '0'})),
      state('expanded', style({height: '*'})),
      transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
    ]),
  ],
})
export class CustomerComponent implements OnInit {
  columnsToDisplay: string[] = ['customerName', 'customerPhone', 'customerEmail', 'created_at'];
  dataSource : any;
  expandedElement : any;
  addCustomer : boolean = false;
  ProposalByCustomer : any;

  constructor(public rest : CustomerService) { }

ngOnInit(){
  this.getCustomer();
}

getCustomer() {
     this.rest.getCustomers(localStorage.getItem('currentUser')).subscribe(result => {
       console.log(result);
        if(result['status'] == 1){
           this.dataSource = result['value'];
        }

       });
}

applyFilter(filterValue: string) {
  this.dataSource.filter = filterValue.trim().toLowerCase();

  if (this.dataSource.paginator) {
    this.dataSource.paginator.firstPage();
  }
}

getProposalByCustomer(customer){
   console.log(customer);
   let  token = localStorage.getItem('currentUser');
   console.log(token);
   let data = {customerId :  customer.customerId};
   console.log(data);
   this.rest.getProposalByCustomer(data , token).subscribe(result => {
    console.log(result);
    if(result['status'] == 1){
      this.ProposalByCustomer = result['data'];
    }
  })
}

addCustmr() {
     this.addCustomer = !this.addCustomer;
    }
}
Anurag Ranjan
  • 127
  • 2
  • 14

0 Answers0