File

lib/examples/src/example-questions/example-questions.module.ts

Extends

QuestionStore

Index

Properties
Methods

Constructor

constructor()

Methods

Protected addConfig
addConfig(config: ConfigOf<I>)
Inherited from ItemStore
Defined in ItemStore:201
Parameters :
Name Type Optional
config ConfigOf<I> No
Returns : I
Protected addItem
addItem(item: I)
Inherited from ItemStore
Defined in ItemStore:211
Parameters :
Name Type Optional
item I No
Returns : I
Protected addUpdateSubscription
addUpdateSubscription(item: I)
Inherited from ItemStore
Defined in ItemStore:148
Parameters :
Name Type Optional
item I No
Returns : void
Public Async get
get(id: string)
Inherited from ItemStore
Defined in ItemStore:251
Parameters :
Name Type Optional
id string No
Returns : Promise<I | null>
Protected getIdentifyItemFn
getIdentifyItemFn(identifyItemBy: undefined | string | )
Inherited from ItemStore
Defined in ItemStore:167
Parameters :
Name Type Optional
identifyItemBy undefined | string | No
Returns : string
Protected Async init
init(config: ItemStoreConfig<I>)
Inherited from ItemStore
Defined in ItemStore:132
Parameters :
Name Type Optional
config ItemStoreConfig<I> No
Returns : Promise<void>
Protected removeItem
removeItem(item: I)
Inherited from ItemStore
Defined in ItemStore:227
Parameters :
Name Type Optional
item I No
Returns : I
Protected removeUpdateSubscription
removeUpdateSubscription(item: I)
Inherited from ItemStore
Defined in ItemStore:157
Parameters :
Name Type Optional
item I No
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>

Properties

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{}

results matching ""

    No results matching ""