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
51 lines (41 loc) • 1.3 kB
text/typescript
import { AccordionComponent } from './sui.accordion.component';
import { AccordionToggleComponent } from './sui.accordion.toggle.component';
import {
Component,
Input,
Host,
forwardRef,
Inject,
ContentChild,
ElementRef
} from '@angular/core';
export class AccordionGroupComponent {
cssClass: string = '';
style: Object = {};
headerClass: string = '';
headerStyle: Object = {};
icon: string = '';
isOpened: boolean = false;
toggler: ElementRef;
constructor(
public accordion: AccordionComponent) {
}
checkAndToggle() {
// if custom toggle element is supplied,
// then do nothing, custom toggler will take care of it
if (this.toggler)
return;
this.toggle();
}
toggle() {
const isOpenedBeforeWeChange = this.isOpened;
if (this.accordion.closeOthers)
this.accordion.closeAll();
this.isOpened = !isOpenedBeforeWeChange;
}
}