Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 角度4+;窗体控件的无值访问器_Angular_Contenteditable_Reactive Forms - Fatal编程技术网

Angular 角度4+;窗体控件的无值访问器

Angular 角度4+;窗体控件的无值访问器,angular,contenteditable,reactive-forms,Angular,Contenteditable,Reactive Forms,我在使用角度形式值访问器时遇到了很大的问题。 错误如下:“SectionComponent.ngfactory.js中名为“textTitle”的表单控件没有值访问器” 我正在使用一个名为ContentEditable的角度库,它实现了ControlValueAccessor,将文本设置为可编辑并将其链接到表单 这是我的反应表: this.form = new FormGroup({ descriptionText : new FormControl(this.descriptionTe

我在使用角度形式值访问器时遇到了很大的问题。 错误如下:“SectionComponent.ngfactory.js中名为“textTitle”的表单控件没有值访问器” 我正在使用一个名为ContentEditable的角度库,它实现了ControlValueAccessor,将文本设置为可编辑并将其链接到表单

这是我的反应表:

  this.form = new FormGroup({
  descriptionText : new FormControl(this.descriptionText),
  textTitle: new FormControl(this.titleText),
  buttonText : new FormControl(this.buttonText)
  })
以下是可编辑内容之一:

<form [formGroup]="form">
<div class="descriptionSectionBlock title" [ngStyle]='{  }'
     *ngIf="currentSection.titleText.textDisplayed" >
  <div [ngStyle]='{ }'>
    <h2 contentEditable="true" formControlName="textTitle"
        (blur)="updateTextContent('title')"
        [ngStyle]='{ }'>
      {{titleText}}
    </h2>
  </div>
</div>
<div class="descriptionSectionBlock description" [ngStyle]='{  }'
     *ngIf="currentSection.descriptionText.textDisplayed" >
  <div [ngStyle]='{  }'>
    <p contentEditable="true" formControlName="descriptionText"
       (blur)="updateTextContent('description')"
       [ngStyle]='{  }'>
      {{descriptionText}}
    </p>
  </div>
</div>
<div [ngStyle]='{ }' class="descriptionSectionBlock button"
     *ngIf="currentSection.CTAButtonDisplay">
  <button contentEditable="true" formControlName="buttonText" (mouseover)="hover=true" (mouseleave)="hover=false"
          (blur)="updateTextContent('button')"
          [ngStyle]='{
           }' mat-raised-button>
    {{buttonText}}
  </button>
</div>
</form>

{{titleText}}

{{descriptionText}}

{{buttonext}}

我不明白我做错了什么。感谢您的帮助。

formControlName必须用于输入html标记

Fuckinhell

这是因为我使用了contentEditable属性,而不是contentEditable属性


我喜欢这种错误描述…

有什么问题/例外?我从SectionComponent.ngfactory.js中得到了一个名为“textTitle”的表单控件无值访问器:/descriptionTitle和ButtontTitle相同……您导入了模块吗?是的,form和reactiveform都是导入的:/n它应该可以在实现FormValueAccessorformControlName的每个组件上使用,因为FormValueAccessorformControlName是用于输入的,如果想要输出,应该执行{{form.get('description').value}}。你至少可以试一试吗?contentEditable库的全部目的是允许编辑文本。他们甚至在github上写道FormValueAccesor已经实现。我不能也不会使用输入,因为这不是我要寻找的行为…对不起,我误解了你的评论,我想^^你是在谈论输入属性?明白。我希望您能找到解决方案,因为从我的感受来看,您将无法使用ReactiveForms实现这一点。也许可以尝试使用NGM模型?