Guest User

Untitled

a guest
Apr 25th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <div *ngSwitchCase="'checkbox'"> <small>checkbox</small>
  2. <div *ngFor="let opt of question.options" >
  3. <label class="container-vertical"> {{opt.value}}
  4. <input type="checkbox"
  5. [formControlName]="question.key"
  6. [name]="opt.name"
  7. [value]="opt.key"
  8. [checked]="opt.selectedOption"
  9. (change)="onChangeValue($event)"
  10. (blur)="onChangeValue($event)"
  11. >
  12.  
  13. <span class="checkmark2"></span>
  14. </label>
  15. </div>
  16. </div>
  17.  
  18. handleCheckBoxChange (event: any) {
  19.  
  20. console.log(".............. ",event);
  21. console.log("selected Value ", event.target.value);
  22.  
  23. var target = event.target || event.srcElement || event.currentTarget;
  24. var idAttr = target.attributes.id;
  25. console.log("question id", idAttr);
  26.  
  27.  
  28. }
  29.  
  30. <div *ngSwitchCase="'checkbox'"> <small>checkbox</small>
  31. <div *ngFor="let opt of question.options" >
  32. <label class="container-vertical"> {{opt.value}}
  33. <input type="checkbox"
  34. [formControlName]="question.key"
  35. [name]="opt.name"
  36. [value]="opt.key"
  37. [(ngModel)]="opt.selectedOption"
  38. (change)="onChangeValue()"
  39. (blur)="onChangeValue()"
  40. >
  41.  
  42. <span class="checkmark2"></span>
  43. </label>
  44. </div>
  45. </div>
  46.  
  47. onChangeValue() {
  48. console.log(this.question);
  49. }
Add Comment
Please, Sign In to add comment