aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/form-components/radio-buttons/radio-buttons.component.ts
blob: 0f80e2ad446d4a48baa40876e90b2785406bbb73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * Created by rc2122 on 9/4/2017.
 */
import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
import { RadioButtonModel } from 'app/models'
import {UiElementBaseInterface, UiElementBase} from "../ui-element-base.component";

@Component({
    selector: 'radio-buttons',
    templateUrl: './radio-buttons.component.html',
    styleUrls: ['./radio-button.component.less']
})
export class RadioButtonComponent  extends UiElementBase implements UiElementBaseInterface {
    
    onSave() {
        this.baseEmitter.emit(this.value);
    }

    @Input() options:Array<RadioButtonModel>;
    @Input() readonly:boolean;
    @Input() direction:string = 'vertical'; //get 'horizontal' | 'vertical'
    value:any;
    
    select(value:any) {
        this.value = value;
        this.baseEmitter.emit(this.value);
    }
}