Return Json value with angular 2

Asked

Viewed 209 times

1

I am working on a project where I need to return a database value that is picked up via REST in json format. The front end of the project is in angular 2.

I have a workers' table and I need that when the user clicks on the edit button, it already brings the values of the database in the boxes.

I’m a beginner in angular 2.

  • And what is the error of your implementation? What is the code you are using that is in error?

  • Does not point error :

  • @Leticiafatima, your question is very broad. I would suggest that you reformulate it. Read here

1 answer

0


Try using Reactiveforms from Angular together with Formgroup and its formControls.

Basically you normally configure the form in HTML and Typescript you define values, validators and etc.

In the table when clicking you should call the angular Http api and associate the API response values to formgroup with setValue.

I created a plunker below with fixed data to be clearer, I hope to have helped :).

http://plnkr.co/edit/fOIirV6sIRhYjjspTDQ8?p=preview

Browser other questions tagged

You are not signed in. Login or sign up in order to post.