0

I am writing a code to convert

HH:MM to H.M i.e 4:20 hrs == 4.33 hrs equivalent.

Here For that I want to convert the 20 minutes to 0.33 hrs by dividing it by 60.

But everytime I get infdig scope error.

I have tried using

Number((minutes/60).toFixed(2))

-> no luck

Math.round((minutes/60 + Number.EPSILON) * 100) / 100 

-> still no luck.

Can please anyone help me out here ?

V K
  • 87
  • 4
  • 13
  • 1
    give a `console.log(minutes)` and see the value in it – Adarsh Mohan Mar 15 '21 at 12:44
  • FYI 20/60 = 0.33 – Abishek Kumar Mar 15 '21 at 12:45
  • Yes its not a string. i logged values – V K Mar 15 '21 at 12:53
  • 1
    [Error: $rootScope:infdig Infinite $digest Loop](https://docs.angularjs.org/error/$rootScope/infdig#:~:text=Error%3A%20%24rootScope%3Ainfdig&text=This%20error%20occurs%20when%20the,the%20browser%20to%20become%20unresponsive.) I don't think it's because of the code you've shared. You're assigning something to the model that triggers a state change and requires an update in the next digest cycle. – phuzi Mar 15 '21 at 13:02

1 Answers1

1

There is nothing wrong with your code. An infdig scope error relates to a state change and subsequent $digest cycle in your component. See https://docs.angularjs.org/error/$rootScope/infdig

Paul
  • 11
  • 1