What is the $location service used for in single-page applications?

$location manages the URL in a single-page application (SPA) and facilitates navigation without reloading the page, handling path, hash, and search parameters.

$location.path('/newPath');