jeudi 16 novembre 2017

Need to show/hide a dropdown after checking/unchecking a checkbox in angular 4

I have a specific requirement in Angular4. I need to display a dropdown after selecting/checking a checkbox and if I uncheck the checkbox then dropdown will hide. Below is the code of the checkbox.

    <div *ngIf="item.showOperationField">
        <p-checkbox
            value ="inflationaryImpactCheck"
            label="Save for Inflationary Impact"
            name = "calculationSaveInflation"
            [(ngModel)]="item.inflationaryImpact"
            pTooltip="Check the Inflationary Impact box to map this calculation to an index for Inflationary Pressure calculation.">
        </p-checkbox>
    </div>

After clicking/unclicking the checkbox

    <div *ngIf="item.showOperationField">
        <p-dropdown
            [style]="{'width':'200px'}"
            [options]="inflation"
            name = "calculationInflation"
            [(ngModel)]="item.selectedInflation">
        </p-dropdown>
    </div>

Please help me and let me know how to do this

Aucun commentaire:

Enregistrer un commentaire