Guest User

Untitled

a guest
Oct 11th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. <div class="col-sm-4 pl-0 DS-xs-p-0 DS-user-col"
  2. *ngFor="let item of list">
  3. <div class="DS-user-card">
  4. <app-card-container class="text-center">
  5. <app-card-body>
  6.  
  7. <h5 class="mb-1 DS-champ-name">
  8. {{item.id}}
  9. </h5>
  10.  
  11. <div class="row">
  12. <div class="col-6 text-right">
  13. <app-input-container>
  14. <input type="text" placeholder="1º Tempo" formControlName="first_time">
  15. </app-input-container>
  16. </div>
  17.  
  18. <div class="col-6 text-left">
  19. <app-input-container>
  20. <input type="text" placeholder="1º Tempo" formControlName="second_time">
  21. </app-input-container>
  22. </div>
  23. </div>
  24.  
  25. <form [formGroup]="forms['result'+item.id]" class="row">
  26. <div class="col-6 text-right">
  27. <app-input-container>
  28. <input type="text" placeholder="2º Tempo" formControlName="third_time">
  29. </app-input-container>
  30. </div>
  31.  
  32. <div class="col-6 text-left">
  33. <app-input-container>
  34. <input type="text" placeholder="2º Tempo" formControlName="fourth_time">
  35. </app-input-container>
  36. </div>
  37.  
  38. <div class="col-12 text-right pt-1">
  39. <app-button-container>
  40. <button appButton color="info">
  41. Salvar
  42. </button>
  43. </app-button-container>
  44. </div>
  45. </form>
  46. </app-card-body>
  47. </app-card-container>
  48. </div>
  49. </div>
  50.  
  51. export class ResultsPageComponent implements OnInit {
  52. list: Array<any>;
  53. formGroupList: any = {};
  54.  
  55. constructor(private route: ActivatedRoute,
  56. private fb: FormBuilder) {}
  57.  
  58. buildForms(list: Array<any>): void {
  59. list.forEach(element => {
  60. this.formGroupList['result' + element.id] = this.fb.group({
  61. first_time: ['', [
  62. StringValidation
  63. ]],
  64. second_time: ['', [
  65. StringValidation
  66. ]],
  67. third_time: ['', [
  68. StringValidation
  69. ]],
  70. fourth_time: ['', [
  71. StringValidation
  72. ]]
  73. });
  74. });
  75. }
  76.  
  77. ngOnInit(): void {
  78. // this.list = this.route.snapshot.data.results;
  79. this.list = [
  80. {
  81. id: 1,
  82. first_time: 1,
  83. second_time: '',
  84. third_time: 2,
  85. fourth_time: ''
  86. },
  87. {
  88. id: 2,
  89. first_time: 1,
  90. second_time: 4,
  91. third_time: 2,
  92. fourth_time: ''
  93. },
  94. {
  95. id: 3,
  96. first_time: 3,
  97. second_time: '',
  98. third_time: 2,
  99. fourth_time: ''
  100. }
  101. ];
  102.  
  103. this.buildForms(this.list);
  104. }
Add Comment
Please, Sign In to add comment