-1

I want ask some question about routing and navigating in angular CLI v1.6.8

In HTML, we can use:

<p id="my_id">Hello World</p>

<a href="#my_id">Link</a>

How to use it in routerLink? I can't use href because I want to make SPA

Thanks before

  • 1
    routerLink is a directive of Angular. You're asking a question about AngularJS, which is a completely different framework. It's perfectly normal to use href in an AngularJS application. And yes, it will still be an SPA, and the AngularJS router will deal with it. – JB Nizet Mar 10 '18 at 16:01
  • I'm sorry sir, I have lack of knowledge because I am newbie. I already try to use href, but my page refreshed, dont like when use routerLink – Hans Stefanus Mar 10 '18 at 16:16
  • Possible duplicate of [Angular2 Routing with Hashtag to page anchor](https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor) – JB Nizet Mar 10 '18 at 17:00

1 Answers1

0

It will depend on the router you are using, you can use UI Router for angular 1.X routing if you are using UI router you have "ui-sref" to use instead of href.

Nijas Nizam
  • 151
  • 7