How to calculate distance of a route on agm (Angular google map) that has waypoints

Hi

I am using angular google maps on my projects to display multiple routes using waypoints. I wanted to know if there is an agm module or a way of calculating the total distance from the origin to the last waypoint?

Thanks