Sharing Top Content from the Angular-sphere.

What is going on with this Angular code? : angularjs

  • The form is like a rating form, and I want to display to the user the average rating, it is 5 questions, based on a score of 1-5.
  • The math works, but if you select the radio boxes going backwards.
  • meaning start selecting the 5 question, and going to question 1, and you STOP before selecting the last radio box the math is all screwy.
  • For example selecting “option 3” for 4 out of 5 questions comes up with an average of 666.6?
  • If you select the elements in the correct order going from question 1 to question 5, the math works out even if you stop selecting options?

I am working on a form with Angular and ran into an odd issue. The form is like a rating form, and I want to display to the user the average rating, it is 5 questions, based on a score of 1-5. Easy right?

I am working on a form with Angular and ran into an odd issue. The form is like a rating form, and I want to display to the user the average rating, it is 5 questions, based on a score of 1-5. Easy right?

Add them together and divide by 5?

The math works, but if you select the radio boxes going backwards.. meaning start selecting the 5 question, and going to question 1, and you STOP before selecting the last radio box the math is all screwy. For example selecting “option 3” for 4 out of 5 questions comes up with an average of 666.6? But that should come out to an average of 2.4. If you select the elements in the correct order going from question 1 to question 5, the math works out even if you stop selecting options?

I created a fiddle so you can see this.

Anyone know what is going on under the hood in Angular that is coming out like this? It’s not really a big deal for me, but I am very curious.

What is going on with this Angular code? : angularjs

Comments are closed, but trackbacks and pingbacks are open.