亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

json對象不影響查看

json對象不影響查看

料青山看我應如是 2023-09-18 16:17:46
我正在使用 Angular Formio 進行動態屏幕創建,作為其中的一部分,當我從數據庫獲取屏幕腳本時,如果我更改特定元素的標簽,我就可以ngOnInit()更改。但是一旦顯示屏幕,如果我更改標簽,它就不會生效。html<Formio [form]="form" [submission]="submission" (submit)="onSubmit($event)"></formio><div class="mb-5">    <div class="row">      <div class="col-12 mb-5">        <div class="pull-right" style="float:right;">          <button class="btn save-button" (click)="clearData()">Clear data</button>          <button class="btn save-button" (click)="showData()">Show data</button>        </div>      </div>    </div>  </div>成分ngOnInit() {    debugger;    this.triggerRefresh = new EventEmitter();    this.http.get('http://localhost:3000/angcomp/3')    .subscribe(      response  => {        debugger;        this.data = response.json();        this.form = this.data;        this.form.components[0].label = 'Changed';//it is updating the lable in view      },        err => {console.error(err)}    ); }showData() {    this.form.components[0].label = 'Again Changed'; // here it is not changing but in this.form.components[0].label value is displaying as 'Again Changed', but not effecting in front end}
查看完整描述

1 回答

?
鴻蒙傳說

TA貢獻1865條經驗 獲得超7個贊

嘗試 formio 中的刷新屬性


在 HTML 中:


<Formio [refresh]="triggerRefresh" [form]="form" [submission]="submission" (submit)="onSubmit($event)"></formio>

在您的組件中:


showData() {

    this.form.components[0].label = 'Again Changed';

    this.triggerRefresh.emit({

    form: this.form

});

}

https://github.com/formio/angular-formio/wiki/Form-Renderer#updating-forms-and-submissions


查看完整回答
反對 回復 2023-09-18
  • 1 回答
  • 0 關注
  • 110 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號