1

I'm trying to use anchor tags to navigate to a certain section of a page. I referred to this post and used the suggested solution. Although the solution works, I get this console error:

Error: Cannot match any routes. URL Segment: 'helpComp'

where helpComp is the id of div I'm navigating to.

My guess is that the # conflicts with the HashLocationStrategy which I am required to use. Can someone suggest an alternative to using the anchor and # for navigating within the page or other ideas?

I can't share my code but here is the general idea:

<a href="#helpComp">Step 1</a>
<p id="helpComp">Contents</p>

When I click on Step 1, it takes me to the correct section of the page but the console displays the above error.

Vikas
  • 11,859
  • 7
  • 45
  • 69
  • Hi, mate welcome to SO it would be great if you could share your code. Please review [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) to learn some details about the expected format of questions on the site. – Vikas Jun 07 '18 at 15:51
  • I've added a few changes. Does the problem seem clear now? – Trying hard Jun 07 '18 at 17:03
  • Check this [out](https://github.com/angular/angular/issues/13636) – Vikas Jun 07 '18 at 17:12
  • So is there no support for page jumps in HashLocationStrategy? – Trying hard Jun 07 '18 at 17:35
  • Well, the open issue about navigating with fragments says that Anyways I will upvote your question see what other's got to say about this – Vikas Jun 07 '18 at 17:41
  • This might [help](https://stackoverflow.com/a/48278403/5695162) – Vikas Jun 07 '18 at 17:45

0 Answers0