简体   繁体   中英

Angular 9 - patch value with a static object

I have this patch value here,I just pass an object to this.

this.formPesquisar.controls['daniloTeste'].patchValue(this.dadosVisualizar.daniloTeste);

But I want to pass a static object, something like:

this.formPesquisar.controls['daniloTeste'].patchValue(2,'OBJETO');

How could i do this in angular 9? It's a form control patch value.

Not sure what you're trying to do here... but if you want to pass object as parameter of patchValue than just use curly braces:

   this.formPesquisar.controls['daniloTeste'].patchValue({
       key1: 'value1',
       key2: 'value2'
   });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM