aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/checkbox/checkbox.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/angular/form-elements/checkbox/checkbox.component.ts')
-rw-r--r--src/angular/form-elements/checkbox/checkbox.component.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/angular/form-elements/checkbox/checkbox.component.ts b/src/angular/form-elements/checkbox/checkbox.component.ts
new file mode 100644
index 0000000..ec05eac
--- /dev/null
+++ b/src/angular/form-elements/checkbox/checkbox.component.ts
@@ -0,0 +1,21 @@
+import { Component, Input, Output, EventEmitter, ViewEncapsulation } from '@angular/core';
+import template from "./checkbox.component.html";
+
+@Component({
+ selector: 'sdc-checkbox',
+ template: template,
+ encapsulation: ViewEncapsulation.None
+})
+export class CheckboxComponent {
+ @Input() label:string;
+ @Input() checked:boolean;
+ @Input() disabled:boolean;
+ @Output() checkedChange:EventEmitter<any> = new EventEmitter<any>();
+
+ public toggleState(newState:boolean) {
+ if (!this.disabled) {
+ this.checked = newState;
+ this.checkedChange.emit(newState);
+ }
+ }
+}