Ask me is how to create a "Accordion List ".
I need it for a few sections with the example "About us" "Services" that at the moment I click, I will display information.
I hope you can help me. is in ionic 4
Ask me is how to create a "Accordion List ".
I need it for a few sections with the example "About us" "Services" that at the moment I click, I will display information.
I hope you can help me. is in ionic 4
This is not an included component within Ionic 4 but it's not a hard problem to solve.
You can use Angular Material's expansion panel if you want to use an off the shelf component.
If you just want a quick overview it would be something like this:
Bonus considerations for deep linking support:
Josh has a tutorial on it - Creating an Accordion List in Ionic.
There is also a detailed tutorial over on Mastering Ionic.
Here I am using flag. After click on the image the next panel will open. Which is [hidden] first time.For multiple clicking on the image I am using flag in .ts file. This is helpful for static list.
.html file
<img style="width:14px; height:14px;" src="assets/down_arrow.png" (click)="accordion()">
<ion-row [hidden]="panel" class="panel">
<div id="line"></div>
<ion-text style="padding-left:7px; padding-right:7px; font-size:11px;">>Description</ion-text>
</ion-row>
.ts file
panel = 1;
flag = 0;
accordion(){
if(this.flag == 0){
this.panel++;
this.flag = 1;
}
else if(this.flag == 1){
this.panel--;
this.flag = 0;
}
console.log(this.panel);
}