summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/dynamic-element/elements-ui/checkbox/ui-element-checkbox.component.ts
blob: 152303aee7ca64e0aceb981b7a65cdee29f8be09 (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
import { Component, ViewChild, ElementRef, ContentChildren, Input } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'
import { UiElementBase, UiElementBaseInterface } from './../ui-element-base.component';

@Component({
  selector: 'ui-element-checkbox',
  templateUrl: './ui-element-checkbox.component.html',
  styleUrls: ['./ui-element-checkbox.component.less'],
})
export class UiElementCheckBoxComponent extends UiElementBase implements UiElementBaseInterface {

  constructor() {
    super();
  }

  ngAfterContentInit() {
    // Convert the value to boolean (instanceOf does not work, the type is undefined).
    if (this.value==='true' || this.value==='false') {
      this.value = this.value==='true'?true:false;
    }
  }

    onSave() {
        this.baseEmitter.emit(this.value);
    }

}