angular4-collapsible
Version:
Angular 2 / 4 Materialize CSS collapsible components
71 lines (60 loc) • 1.92 kB
text/typescript
import {
Component,
OnChanges, SimpleChanges,
Input,
ContentChildren, QueryList
} from '@angular/core';
import { CollapsibleListItemComponent } from './collapsible-list-item.component';
import { CollapsibleService } from './collapsible.service';
export class CollapsibleListComponent implements OnChanges {
// component options
//
// describes the type of the collapsible list: 'accordion' or 'expandable'
type: 'accordion' | 'expandable' = 'accordion';
contentListItems: QueryList<CollapsibleListItemComponent>;
constructor(private collapsibleService: CollapsibleService) { }
ngOnChanges(changes: SimpleChanges): void {
for (let change in changes) {
if (change === 'type') {
// console.debug('CollapsibleListComponent::ngOnChanges(), currentValue = ' + changes.type.currentValue);
this.type = changes.type.currentValue;
this.collapsibleService.setType(this.type);
}
}
}
}