Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@Injectable() export class RenderingTranslationService {
constructor() {}
private renderingTranslationRules: RenderingTranslationRule[] = [RenderingTranslationRule.freetextRenderingRule, RenderingTranslationRule.radioRenderingRule, RenderingTranslationRule.checkboxRenderingRule, RenderingTranslationRule.comboboxRenderingRule];
getRenderingForQuestion(question: Question): Rendering {
let renderingToReturn;
for (const renderingTranslationRule of this.renderingTranslationRules) {
if (renderingTranslationRule.booleanExp(question)) {
renderingToReturn = renderingTranslationRule.rendering;
if (!renderingToReturn) {
throw new Error('No renderings for question: ' + question.externalQuestionId);
return renderingToReturn;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment