Tuesday, 30 November 2021

pdf viewer in angular

 how to preview the pdf in angular 

pdf viewer in angular


 [disabled]="chargeDetailsValues.chargeTypeDescription == 'GENERAL' "
disable in angular based on value bind

Saturday, 27 November 2021

select only year in date picker angular material

 1.using angular material only year should select for this i have written this.


TS

openDatePicker(dp:any) {
  dp.open();
}

closeDatePicker(D: any, dp ? : any) {debugger
 
  // get month and year from eventData and close datepicker, thus not allowing user to select date
  dp.close();

  var date = new Date(D);
  var year = date.getFullYear();
  alert(year);
}
}

HTML
 <mat-form-field>
   <input matInput [matDatepicker]="dp2" [(ngModel)]="tripInformations.productionYear" name="productionYear" placeholder="Select a Date" (click)="openDatePicker(dp2)" />
  <mat-datepicker-toggle matSuffix [for]="dp2"></mat-datepicker-toggle>
  <mat-datepicker #dp2 startView="multi-year" (yearSelected)="closeDatePicker($event, dp2)"></mat-datepicker>
         </mat-form-field>


date pipe
 <input matInput type="text" placeholder="PU DATE" [ngModel]="tripInformations.requiredDate | date:'yyyy-MM-dd'" (ngModelChange)="tripInformations.requiredDate = $event"
                                              name="requiredDate" readonly />

Friday, 26 November 2021

Tuesday, 23 November 2021

dropdown dependencies

 filter dropdown two based on one example

https://stackblitz.com/edit/flight-date-pikcer-ofkkme?file=src%2Fapp%2Fflight%2FairportPipe.ts

check this


check working filter array


difference between dates dates


Thursday, 18 November 2021

separate alpha numeric

 var result = "NewFolder333".match(/[^\d]+|\d+/g);

alert(result);
Output:Newfolder,333

Saturday, 13 November 2021

angular material popup issue

 popup not closing after save

so then i given dialog ref inside component then its working fine

so 


constructor(private dialogRef: MatDialogRef<MyDialogComponent>){ }

closeDialog(){
  this.dialogRef.close();
}

popup issue

Friday, 5 November 2021

remove null and undefined and empty

 1.from object key and value null remove from object is important 

check here

gatein after list edit old code

  loadTransaction(transactionNo: string) {

    this.gateInService.gettrucktransaction(transactionNo).subscribe((res: any) => {
      if (res) {
        console.log(res);
        this.enableSizeValidation = false;
        this.allDetails = res;
     //   this.dataSourceGateInSummary = res["truckItems"];
       console.log (this.dataSourceGateInSummary.data)
        this.validateSize();
        let filterData = res.invoiceDetails.filter(i => i.sellingAmount != 0)
        //handle later
        let count =0;
        for (let i = 0; i < filterData.length; i++) {
         if(filterData[i].chargeCode==="GATE-E")
         {
           count++
           if(count >1){
             filterData.splice(i,1);
           }
         }
         }
        this.dataSourcePaymentDetails = filterData;
        console.log(this.dataSourcePaymentDetails);
        //    this.dataSourcePaymentDetails.filter(i=>i.sellingAmount !=0)
        this.sellingAmount = res["sellingAmount"];
        this.vatAmount = res["vatAmount"];
        this.nettAmount = res["nettAmount"];
        this.whTaxAmount = res["whTaxAmount"];
        this.invoiceNo = res["invoiceNo"];
        this.sumOfMovements = res["truckItems"].length;
      }
    });
  }

c#

 https://github.com/dcyuksel/Result