Guest User

Untitled

a guest
Apr 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. this.form = this.fb.group({
  2. displayName: [user.displayName, Validators.required],
  3. profile: this.fb.group({
  4. gender: [user.profile.gender, Validators.required],
  5. birthday: [user.profile.birthday, Validators.required],
  6. place_of_birth: [user.profile.place_of_birth, Validators.required],
  7. place_of_residence: [user.profile.place_of_residence, Validators.required],
  8. about_me: [user.profile.about_me, Validators.required],
  9. interests: [user.profile.interests, Validators.required],
  10. sport: [user.profile.sport, Validators.required],
  11. highSchool: this.fb.array(educationFGs)
  12. })
  13. });
  14.  
  15. this.educations.splice(index, 1);
  16. const educationFGs = this.educations.map(education => this.fb.group(education));
  17. const educationArray = this.fb.array(educationFGs);
  18.  
  19. this.form.setControl('highSchool', educationArray);
  20.  
  21. add() {
  22. const fa = this.form.get('profile.highSchool') as FormArray;
  23. fa.push(this.fb.group({
  24. name: '',
  25. date: ''
  26. }));
  27. }
  28.  
  29. remove(index) {
  30. const fa = this.form.get('profile.highSchool') as FormArray;
  31. fa.removeAt(index);
  32. }
Add Comment
Please, Sign In to add comment