I'm using angular 17, and I want to make a page that contains multiple components but each component can be accessed through a path (when clicking on the navigation menu it automatically scrolls there and changes the path of that specific component) [see the image above]
but when manually scrolling I also want it to be detected by the app and automatically change the path to the correct one according to the component being displayed

Since you want to point to a specific location inside of a page, I think you should use fragments instead of the path.
You can use an Intersection Observer to detect when the component is inside of the viewport and when your fragment should change. Then use NavigationExtras of the routers navigate method to change the fragments.
Code for navigation should look similar to: