### File

`src/question/question.model.ts`

### Index

###### Properties
Public answer Public dependencies Public description Public disabled Public name Public type Public validations
###### Methods
Public isRequired

### Constructor

`constructor(name: string, description: string, type: QuestionType, dependencies: Dependency[], answer: Answer | AnswerType, validations: Validation[], disabled: boolean)`
Defined in src/question/question.model.ts:4
Parameters :
Name | Type | Optional | Description
name | `string` |  |
description | `string` |  |
type | `QuestionType` |  |
dependencies | `Dependency[]` |  |
answer | `Answer | AnswerType` |  |
validations | `Validation[]` |  |
disabled | `boolean` |  |

### Methods

Public isRequired
`isRequired()`
Defined in src/question/question.model.ts:16
Returns : `boolean`

### Properties

Public answer
`answer: `Answer | AnswerType``
Type : `Answer | AnswerType`
Defined in src/question/question.model.ts:11

Public dependencies
`dependencies: `Dependency[]``
Type : `Dependency[]`
Defined in src/question/question.model.ts:10

Public description
`description: `string``
Type : `string`
Defined in src/question/question.model.ts:8

Public disabled
`disabled: `boolean``
Type : `boolean`
Default value : `false`
Defined in src/question/question.model.ts:13

Public name
`name: `string``
Type : `string`
Defined in src/question/question.model.ts:7

Public type
`type: `QuestionType``
Type : `QuestionType`
Defined in src/question/question.model.ts:9

Public validations
`validations: `Validation[]``
Type : `Validation[]`
Defined in src/question/question.model.ts:12

    import { Answer, Dependency, QuestionType } from '.';
    import { Pattern, Validation, ValidationType } from '../validation';

    export abstract class Question<AnswerType> {

      public constructor(
        public name: string,
        public description: string,
        public type: QuestionType,
        public dependencies: Dependency[] = [],
        public answer: Answer<AnswerType> | AnswerType = null,
        public validations: Validation[] = [],
        public disabled: boolean = false
      ) { }

      public isRequired(): boolean {
        for (const validation of this.validations) {
          if (validation.isRequired()) {
            return true;
          }
        }

        return false;
      }
    }

# results matching ""

# No results matching ""