UNPKG

angular2-simple-ui

Version:

Angular 2 Simple Material Design UI Components customisable with Simple 30 KB CSS with LESS support and full features support , just plugin up and run for clarity look at sample examples

40 lines (34 loc) 1.01 kB
import { AccordionGroupComponent } from './sui.accordion.group.component'; import { ContentChildren, Component, QueryList, Input, forwardRef, AfterContentInit } from '@angular/core'; @Component({ selector: 'sui-accordion', templateUrl: './sui.accordion.component.html', }) export class AccordionComponent implements AfterContentInit { @Input() accordionClass: string; @Input() accordionStyle: Object = {}; @Input() closeOthers = true; @Input() expandAll = false; @ContentChildren(forwardRef(() => AccordionGroupComponent)) groups: QueryList<AccordionGroupComponent>; ngAfterContentInit() { if (this.expandAll) { this.closeOthers = false; this.groups.toArray().forEach(group => { group.isOpened = true; }); } } closeAll() { this.groups.toArray().forEach(group => { group.isOpened = false; }); } }