redoc/lib/shared/components/Zippy/zippy.ts

30 lines
654 B
TypeScript
Raw Normal View History

'use strict';
import { Component, EventEmitter, Output, Input, OnChanges } from '@angular/core';
@Component({
selector: 'zippy',
templateUrl: './zippy.html',
2016-08-22 12:12:13 +03:00
styleUrls: ['./zippy.css']
})
export class Zippy implements OnChanges {
@Input() type = 'general';
@Input() empty = false;
@Input() title;
2016-06-29 18:02:29 +03:00
@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);
2016-06-19 17:41:04 +03:00
}
}
}