surveyjs / surveyjs_angular_cli

SurveyJS + Angular CLI Quickstart Template
http://surveyjs.io/
41 stars 52 forks source link

Adding custom widget in editor #41

Closed SaraaAwwad closed 4 years ago

SaraaAwwad commented 4 years ago

Are you requesting a feature, reporting a bug or ask a question? question

What is the current behavior? I want to add a datepicker in the survey editor. So I add a widget to the surveycreator and use it but it results in the error: Uncaught Error: Unknown component 'svd-property-editor-custom'

What is the expected behavior? I tried the code below in a plunker and it worked fine. Don't know how to work it around in angular

**Provide the test code and the tested page URL (if applicable)

Test code**

Survey.Serializer.addProperty("survey", { name: "dateFormat:date", category: "general" });

var propertyDateWidget = { render : function(editor, el) { var isSetValue = false; var input = document.createElement("input"); input.className = "form-control svd_editor_control"; input.type = "date"; input.onchange = function() { isSetValue = true; editor.koValue(input.value); isSetValue = false; }; el.appendChild(input); } }

SurveyCreator.Extentions.registerCustomPropertyEditor("date", propertyDateWidget);

Specify your browser: chrome editor version:

tsv2013 commented 4 years ago

Duplicate for https://github.com/surveyjs/survey-creator/issues/888