Explorar el Código

Working on CheckButton group - factoring out ControlContainer

Richard Knight hace 6 años
padre
commit
a97ed55f0a

+ 7 - 6
src/app/dynaform/components/custom/checkbutton-group/checkbutton-group.component.ts

@@ -1,5 +1,5 @@
 import { Component, Attribute, OnInit, Input } from '@angular/core';
-import { ControlContainer, FormGroup, FormControl } from '@angular/forms';
+import { /* ControlContainer, */ FormGroup, FormControl } from '@angular/forms';
 
 @Component({
 	selector: 'app-checkbutton-group',
@@ -9,10 +9,10 @@ import { ControlContainer, FormGroup, FormControl } from '@angular/forms';
 export class CheckbuttonGroupComponent implements OnInit {
 
 	@Input()
-	group: FormGroup;
+	control: FormGroup;
 
 	@Input()
-	meta = {};
+	meta: StringMap;
 
 	controlNames: Array<string>;
 	isDisabled: Array<boolean>;
@@ -21,15 +21,16 @@ export class CheckbuttonGroupComponent implements OnInit {
 	firstControl: FormControl;
 
 	constructor(
-		private cc: ControlContainer,
+		/* private cc: ControlContainer */,
 		@Attribute('firstEnablesRest') private firstEnablesRest
 	) {
 		this.firstEnablesRest = firstEnablesRest === ''; // True if 'firstEnablesRest' exists as component attribute
 	}
 
 	ngOnInit() {
-		this.controlNames = Object.keys(this.cc.control.value);
-		console.log(this.controlNames)
+		this.controlNames = Object.keys(this.cc.control);
+		console.log('HERE I AM', this.control, this.meta.name);
+		console.log(this.controlNames);
 		/*
 		const labelShortfall = this.controlNames.length - this.labels.length;
 		if (labelShortfall > 0) {