Skip to content

Instantly share code, notes, and snippets.

@alaawahbah
Created August 14, 2018 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alaawahbah/fcd19fdf8d051cd9c656cae8839265d8 to your computer and use it in GitHub Desktop.
Save alaawahbah/fcd19fdf8d051cd9c656cae8839265d8 to your computer and use it in GitHub Desktop.
<!--<li *ngFor="let responsible of ResponsibleGroup; let i = index" formArrayName="ResponsibleGroup">-->
<li *ngFor="let responsible of employeeSettingsForm.controls.ResponsibleGroup.controls; let i = index">
<label class="form-check-label">
<input class="form-check-input" value="{{responsible.ID}}" type="checkbox" (change)="Changed($event)">
<span class="btn btn-light btn-round btn-sm">{{isArabic?responsible.NameAr:responsible.NameEn}}<i class="fas fa-plus"></i></span>
</label>
</li>
this.allGroups.subscribe(t => {
//this.employeeSettingsForm.controls['ResponsibleGroup'].push( t);
let controlArray = <FormArray>this.employeeSettingsForm.controls['ResponsibleGroup']
t.forEach(app => {
//const fb = this.buildGroup();
//fb.patchValue(app);
//controlArray.push(fb);
controlArray.push(new FormControl(app));
});
})
this.employeeSettingsForm = this.formBuilder.group({
Employee: [null, [Validators.required]],
EmployeeRole: [null],
ResponsibleGroup: this.formBuilder.array([]),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment