DEV Community

ildefonso
ildefonso

Posted on

2

How to update FormGroup values in angular with developer tools.

How to update FormGroup values in angular with developer tools.

(function() {
  var el = document.querySelector('div[ng-reflect-form]'); // Form's node
  var elProbe = ng.probe(el);

  const NgControlClassReference = elProbe.providerTokens.find((p) => {
    return p.name === 'FormGroupDirective';
  });

  var directive = elProbe.injector.get(NgControlClassReference);

  var control = directive.control;

  control.setValue({
    'value1': 'test1', // FormControl
    'value2': 'test2',  // Formcontrol
  });
})();

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more