Angular doubt, forms and counters cycle for

-2

I have to do a quiz where there are around 40 questions, in these each question has 3 options. What I want to do is that from an angular count how many times you chose each of those 3 options and save it to my database. that is all in the backend with nodejs. (I put the options in a select, maybe it's better in another way).

I hope you can help me, and searched for information but on my own I could not understand how to do it.

Someone can explain me from a mini code, how it could work.

    
asked by Cristbal Ignacio Bustamante 24.11.2018 в 16:47
source

1 answer

0

I do not know what version of angular you are using, if I understand you correctly you have a select and you want to know how many times the answer user changes before sending.

  • I imagine you have some value from the select (id, a string ...) option 1 ... 1) use a change event, read the changes in the select with angle 4 would be something like this: (ngModelChange)="example ($ event)" add it to the select.

2) from your .js or .ts file use the "example" method that you added to the select to capture the value of the select and so you can count how many times the value changes.

    
answered by 27.11.2018 в 14:56