Angular 如何从<;获取纯文本;ejsrichtexteditor>;使用表单控件?i';我无法获取它。文本保存在<;p>;xyz</p>;福梅特
如何使用表单控件从获取纯文本?我无法获取它。使用表单控件在forgraph formet中保存文本。我看过使用getText()获取字符串的文档;但无法实现这个如何实现和在哪里写 也不支持。因此我无法编写所需的验证。我像贝娄一样写,并在页面加载时显示Angular 如何从<;获取纯文本;ejsrichtexteditor>;使用表单控件?i';我无法获取它。文本保存在<;p>;xyz</p>;福梅特,angular,angular-material,angular7,rich-text-editor,form-control,Angular,Angular Material,Angular7,Rich Text Editor,Form Control,如何使用表单控件从获取纯文本?我无法获取它。使用表单控件在forgraph formet中保存文本。我看过使用getText()获取字符串的文档;但无法实现这个如何实现和在哪里写 也不支持。因此我无法编写所需的验证。我像贝娄一样写,并在页面加载时显示 <mat-list-item> <ejs-richtexteditor #toolsRTE id='faq_question' [toolbarSettings]='to
<mat-list-item>
<ejs-richtexteditor #toolsRTE id='faq_question' [toolbarSettings]='tools' placeholder="Question" showCharCount="true" minlength ="13" maxLength="100" required formControlName="question:getText();" >
</ejs-richtexteditor>
</mat-list-item>
<mat-error *ngIf="faqForm.controls['question'].hasError('required')">
Question is <strong>required</strong>
</mat-error>
if (this.faqForm.valid ) {
const faq: Faq = {
Id: 0,
CategoryId: this.faqForm.get('categoryType').value,
FAQTopic: this.faqForm.get('question').value,
FAQBody: this.faqForm.get('answer').value,
IsActive: true
};
}
问题是必需的
如果(this.faqForm.valid){
常量常见问题:常见问题={
Id:0,
CategoryId:this.faqForm.get('categoryType').value,
FAQTopic:this.faqForm.get('question').value,
FAQBody:this.faqForm.get('answer').value,
是的
};
}
很快
<ejs-richtexteditor formControlName="question" ...>
</ejs-richtexteditor>
您可以查看此链接如果找不到更简单的方法,此链接可以帮助您
const question='你好,世界
;
const quesionHtml=new DOMParser().parseFromString(问题'text/html');
const htmlastring=quesionHtml.body.innerHTML;
log(htmlastring)
feyzullah yildiz仍然收到类似于如何获取密码的文本我需要在没有的情况下获取密码。你能建议这样做吗?使用view child我可以得到一个值我在表单中有两个编辑器如何得到第二个值?你可以使用ViewChildrenfeyzullah yıldız我使用view child得到单个表单控件值,我有两个富文本编辑器如何管理它?很高兴能帮助@user2564537Ashot-Aleqsanyan如果我使用上述场景,我无法获得粗体strick和color属性,那么富文本编辑器的用途是什么?@user2564537在这种情况下,您需要存储html值而不是text-ashot-Aleqsanyan您能告诉我吗?@user2564537对不起,我不明白?
if (this.faqForm.valid ) {
const {question, answer, categoryType } = this.faqForm.value
const faq: Faq = {
Id: 0,
CategoryId: categoryType,
FAQTopic: question,
FAQBody: answer,
IsActive: true
};
}