redoc/lib/shared/components/Zippy/zippy.ts
2017-02-02 23:13:40 +02:00

30 lines
654 B
TypeScript

'use strict';
import { Component, EventEmitter, Output, Input, OnChanges } from '@angular/core';
@Component({
selector: 'zippy',
templateUrl: './zippy.html',
styleUrls: ['./zippy.css']
})
export class Zippy implements OnChanges {
@Input() type = 'general';
@Input() empty = false;
@Input() title;
@Input() headless: boolean = false;
@Input() open = false;
@Output() openChange = new EventEmitter();
toggle() {
this.open = !this.open;
if (this.empty) return;
this.openChange.emit(this.open);
}
ngOnChanges(ch) {
if (ch.open.currentValue === true) {
this.openChange.emit(ch.open.currentValue);
}
}
}