I start on my routed page:
http://localhost:3000/#/mypage/999999
I have a link like this:
examples
When I click it the page address changes to:
http://localhost:3000/#/mypage/999999#examples
But I am still at the top of the page.
My anchor looks like:
<a name="examples"></a>
try solution here: http://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
also, note that this solution configures angular to use hashtags for url handling. This can be set to false in the app.routing.ts file by changing the 'useHash' setting to false.
Try this:
+-----------HTML--------------------------------------+
...
+------------------COMPONENT------------------------+
import { ElementRef } from '@angular/core';
@Component({...})
export class YourComponent {
@ViewChild('yourElementrRef') myelement : ElementRef;
goToElement(){
this.myelement.nativeElement.focus();
}
}
+---------------------------------------------------------+
OBS:
Closing due to inactivity.