lib/examples/src/example-questions/example-questions.module.ts
Properties |
|
Methods |
|
constructor()
|
Protected addConfig | ||||||
addConfig(config: ConfigOf<I>)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:201
|
||||||
Parameters :
Returns :
I
|
Protected addItem | ||||||
addItem(item: I)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:211
|
||||||
Parameters :
Returns :
I
|
Protected addUpdateSubscription | ||||||
addUpdateSubscription(item: I)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:148
|
||||||
Parameters :
Returns :
void
|
Public Async get | ||||||
get(id: string)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:251
|
||||||
Parameters :
Returns :
Promise<I | null>
|
Protected getIdentifyItemFn | ||||||
getIdentifyItemFn(identifyItemBy: undefined | string | )
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:167
|
||||||
Parameters :
Returns :
string
|
Protected Async init | ||||||
init(config: ItemStoreConfig<I>)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:132
|
||||||
Parameters :
Returns :
Promise<void>
|
Protected removeItem | ||||||
removeItem(item: I)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:227
|
||||||
Parameters :
Returns :
I
|
Protected removeUpdateSubscription | ||||||
removeUpdateSubscription(item: I)
|
||||||
Inherited from
ItemStore
|
||||||
Defined in
ItemStore:157
|
||||||
Parameters :
Returns :
void
|
Protected Async restoreFromStorage |
restoreFromStorage()
|
Inherited from
ItemStore
|
Defined in
ItemStore:193
|
Returns :
Promise<any>
|
Protected Async storeAll |
storeAll()
|
Inherited from
ItemStore
|
Defined in
ItemStore:244
|
Returns :
Promise<void>
|
name |
Type : string
|
Default value : "EXAMPLE_QUESTION_STORE.NAME"
|
Inherited from
ItemStore
|
Defined in
ItemStore:52
|
Protected _map |
Default value : new Map<string,I>()
|
Inherited from
ItemStore
|
Defined in
ItemStore:90
|
Public addition$ |
Default value : this.additionSubject.asObservable()
|
Inherited from
ItemStore
|
Defined in
ItemStore:113
|
Protected additionSubject |
Default value : new Subject<I>()
|
Inherited from
ItemStore
|
Defined in
ItemStore:107
|
Public change$ |
Default value : merge(this.addition$, this.removal$, this.update$)
.pipe( share() )
|
Inherited from
ItemStore
|
Defined in
ItemStore:118
|
Protected identifyItem |
Type : function
|
Inherited from
ItemStore
|
Defined in
ItemStore:104
|
Public itemClass |
Inherited from
ItemStore
|
Defined in
ItemStore:101
|
Public ready |
Type : Promise<void>
|
Inherited from
ItemStore
|
Defined in
ItemStore:111
|
Public removal$ |
Default value : this.removalSubject.asObservable()
|
Inherited from
ItemStore
|
Defined in
ItemStore:114
|
Protected removalSubject |
Default value : new Subject<I>()
|
Inherited from
ItemStore
|
Defined in
ItemStore:108
|
Protected storage |
Type : ItemStorage<I>
|
Inherited from
ItemStore
|
Defined in
ItemStore:102
|
Public update$ |
Default value : this.updateSubject.asObservable()
|
Inherited from
ItemStore
|
Defined in
ItemStore:115
|
Protected updateSubject |
Default value : new Subject<I>()
|
Inherited from
ItemStore
|
Defined in
ItemStore:109
|
Protected updateSubscriptions |
Default value : new Map<string, Subscription>()
|
Inherited from
ItemStore
|
Defined in
ItemStore:97
|
import {
Injectable,
NgModule
} from '@angular/core'
import {
Question,
QuestionConfig,
QuestionStore
} from '@rcc/core'
import {
TranslationsModule,
} from '@rcc/common'
import {
QuestionnaireModule,
QUESTION_STORES
} from '@rcc/features'
const en = {
'NAME': 'Exmaple Questions'
}
const de = {
'NAME': 'BeispielFragen'
}
@Injectable()
export class ExampleQuestionStore extends QuestionStore {
name = "EXAMPLE_QUESTION_STORE.NAME"
constructor(){
super(ExampleQuestionStorage)
}
}
// A Questionstore can get its questions from anywhere:
// localStorage, some REST-API, local file.
// But in this example case we just use static entries, hard coded right here:
const ExampleQuestionStorage = { getAll: () => Promise.resolve(example_configs) }
const example_configs:QuestionConfig[] = [
{
id: 'rcc-example-A',
type: 'integer',
meaning: "just an example question text", // This property will be used to display the question text,
// if translations are missing,
// but it's main purpose is to give the intent of the question.
// (maybe we should drop this property)
translations: {
'en': "What kind of example question is this?",
'de': "Was für eine Beispielfrage ist das denn?"
},
min: 0,
max: 5,
tags: ['rcc-example-question']
},
]
@NgModule({
imports: [
QuestionnaireModule.forChild([ExampleQuestionStore]),
TranslationsModule.forChild("EXAMPLE_QUESTION_STORE", {de ,en}),
],
providers: [
ExampleQuestionStore
]
})
export class ExampleQuestionStoreModule{}