how to add accordian to ionic project
<ion-list>
<div class="input1001" *ngFor="let d of diseases; let i=index" text-wrap (click)="toggleGroup(i)" [ngClass]="{active: isGroupShown(i)}">
<ion-row style="border-radius: 5px;padding-top: 2px;box-shadow:2px 2px 2px 2px #e6e6e6">
<ion-col size="11" style=" padding-left: 5px; font-size:12px
">
{{d.title}}
</ion-col>
<ion-col size="1" style="text-align: right;padding-right: 10px;">
<ion-icon name="chevron-down-outline" *ngIf="!isGroupShown(i)"></ion-icon>
<ion-icon name="chevron-up-outline" *ngIf="isGroupShown(i)"></ion-icon>
</ion-col>
</ion-row>
<div style="height:1px;box-shadow: 1px 1px 1px 1px #F0F0F0 ">
</div>
<!-- <ion-item >
<ion-label>
</ion-label>
</ion-item> -->
<div class="disc" *ngIf="isGroupShown(i)">{{d.description}}</div>
</div>
</ion-list>
toggleGroup(group) {
if (this.isGroupShown(group)) {
this.shownGroup = null;
} else {
this.shownGroup = group;
}
};
isGroupShown(group) {
return this.shownGroup === group;
};
diseases = [
{ title: "Lorem Ipsum is the simply dummy text of the printing?", description: "Type 1 diabetes is an autoimmune disease in which the body’s immune system attacks and destroys the beta cells in the pancreas that make insulin." },
{ title: "Lorem Ipsum is the simply dummy text of the printing?", description: "Multiple sclerosis (MS) is an autoimmune disease in which the body's immune system mistakenly attacks myelin, the fatty substance that surrounds and protects the nerve fibers in the central nervous system." },
{title: "Lorem Ipsum is the simply dummy ?", description: "Crohn's disease and ulcerative colitis (UC), both also known as inflammatory bowel diseases (IBD), are autoimmune diseases in which the body's immune system attacks the intestines." },
{ title: "Lorem Ipsum is the simply dummy text of the printing?", description: "Systemic lupus erythematosus (lupus) is a chronic, systemic autoimmune disease which can damage any part of the body, including the heart, joints, skin, lungs, blood vessels, liver, kidneys and nervous system." },
{ title: "Lorem Ipsum is the simply dummy text of the printing?", description: "Rheumatoid arthritis (RA) is an autoimmune disease in which the body's immune system mistakenly begins to attack its own tissues, primarily the synovium, the membrane that lines the joints." }
];
shownGroup = null;
Comments
Post a Comment