TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
278.3k
I try to make left side menu Collapse as accordion in angula
May 29 2020 8:16 PM
I work on angular 7 app I try to make left side menu accordion Expandable and Collapse but it does not work.
For main menu I display Main Reports Category as:
"let rep of allReportCategories"
style=
"margin-top:2px;"
class
=
"page-sidebar-menu"
data-keep-expanded=
"false"
data-auto-scroll=
"true"
data-slide-speed=
"200"
>
class
=
"accordion"
>{{rep.reportCategory}}
For display sub category reports I depend on CategoryID to join between category and sub Category:
*ngFor=
"let subrep of reportsubCategory"
"subrep.reportCategoryID === rep.reportCategoryID"
class
=
"wrapper"
>
class
=
"sideNav nav navbar"
>{{subrep.reportName}}
CSS Accordion :
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
I work on Stackbliz already have data and Show Main Category and Sub Category but the issue i can't solve Issue of accordion.
https:
//stackblitz.com/edit/create-1arrvm?file=app%2Fapp.component.html
my bussiness logic for button as below :
I need to pass main category to function getreportbycategory but i dont know
this
._displayreport.GetreportByCategoryId(
this
.reportid).subscribe((data: any[]) => {
this
.reportsubCategory = data;
});
toggleAccordian(event, index) {
var
element = event.target;
element.classList.toggle(
"active"
);
this
._displayreport.GetreportByCategoryId(index);
}
also How to display them as accordion when open page .
Reply
Answers (
1
)
How to make field passed to function goToLink dynamically ch
button accordion not work when collapse or expand?