Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/app/models/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ export class Question {
public title: string;
public description: string;
public required: boolean;
public options: any;
public type: any;
public image: string;
public points: any;
public answers: any[];

constructor(title: string = 'Question', description: string = '', required: boolean = false, type: any = '', image: string = '', points: any = '') {
constructor( title: string = 'Question',
description: string = '',
required: boolean = false,
options: any = [],
type: any = '',
image: string = '',
points: any = '' ) {
this.title = title;
this.description = description;
this.required = required;
this.options = options;
this.type = type;
this.image = image;
this.points = points;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

&__header {
text-align: center;
margin-top: 110px;
margin-top: 114px;
position: relative;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@
<div class="pt-question__input">
<input type="text" class="pt-description-input" formControlName="description" placeholder="Description (optional)">
</div>

<div class="pt-question__options" formArrayName="answers">
<div class="pt-question__outer"
*ngFor="let control of form.get('answers').controls; let i = index"
(keydown)="optionNew($event)">

<div class="pt-question__inner" [formGroupName]="i">

<label class="pt-question__label">
<input type="checkbox" formControlName="isCorrect">
<span class="pt-question__circle"></span>
</label>

<input type="text" class="pt-question__option" formControlName="title" placeholder="Add option or Add other">
<i class="pt-question__action pt-photo" (click)="addOptionImage()"></i>
<i class="pt-question__action pt-times" (click)="delete()"></i>
</div>

</div>
<div class="pt-question__more">

<div class="pt-question__label">
<span class="pt-question__circle pt-question__circle_grey"></span>
</div>

<p class="pt-question__option pt-question__option_static">Add option or
<span (click)="addOption()">"Add other"</span>
</p>
</div>
</div>

<div class="pt-question__controls">
<span class="pt-question__button pt-question__remove" (click)="removeQuestion(index)">
<i class="pt-question__icon pt-times"></i>
Expand Down
Loading