Hello everyone! I am a beginner in the world of Web Development and I've run into an issue. Luckily, I was able to create a fiddle showcasing my problem for better understanding.
The challenge at hand involves two sliders: one for a value and another for weight. These sliders are repeated n times using the ng-repeat function - in the fiddle, I have demonstrated this setup with just two repetitions.
What I aim to achieve is calculating an index based on the following formula:
Value1*Weight1 + Value2*Weight2
The index calculation utilizes the reduce function. However, my predicament lies in the fact that the index value does not update when the slider values change. While I believe $watch might be the solution, I am unsure how to implement it.
If anyone could provide some guidance or assistance, I would greatly appreciate it.
You can access the js fiddle through the link below: