ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

Reactive Forms Angular

Open camilo2312 opened this issue 6 years ago • 1 comments

Hello everyone

  1. I implement the use of reactive forms with the ui5-input control but it still doesn't work

image

Visit Issue # 697 but it doesn't work

Still have no support for this?

Do I need to implement any module?

Thanks for the help

camilo2312 avatar Apr 22 '20 15:04 camilo2312

Hi @camilo2312

In order to use UI5 Web Components with Angular two way data binding you have to provide ControlValueAccessor for the used components. In our Angular tutorial you can check out Two-way data binding section.

In order to make it work:

  1. Install Origami:
npm install @codebakery/origami
  1. Import the OrigamiFormsModule from Origami
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { OrigamiFormsModule } from '@codebakery/origami/forms';
import { AppComponent } from './app.component';

@NgModule({
  imports: [BrowserModule, OrigamiFormsModule],
  declarations: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  bootstrap: [AppComponent]
})
export class AppModule {}
  1. Use it in your template
<ui5-input [(ngModel)]="value" origami></ui5-input>

fifoosid avatar Apr 23 '20 09:04 fifoosid