diff --git a/frontend/src/app/components/docs/api-docs-nav.component.html b/frontend/src/app/components/docs/api-docs-nav.component.html
index 8c6d3b006..83eaaf9e8 100644
--- a/frontend/src/app/components/docs/api-docs-nav.component.html
+++ b/frontend/src/app/components/docs/api-docs-nav.component.html
@@ -1,4 +1,4 @@
diff --git a/frontend/src/app/components/docs/api-docs-nav.component.ts b/frontend/src/app/components/docs/api-docs-nav.component.ts
index 630611c15..90588860e 100644
--- a/frontend/src/app/components/docs/api-docs-nav.component.ts
+++ b/frontend/src/app/components/docs/api-docs-nav.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, Input } from '@angular/core';
+import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { restApiDocsData } from './api-docs-data';
@Component({
@@ -9,7 +9,7 @@ import { restApiDocsData } from './api-docs-data';
export class ApiDocsNavComponent implements OnInit {
@Input() network: any;
- @Input() collapseItem: any = { toggle: () => {} };
+ @Output() navLinkClickEvent: EventEmitter = new EventEmitter();
restDocs: any[];
constructor() { }
@@ -17,5 +17,9 @@ export class ApiDocsNavComponent implements OnInit {
ngOnInit(): void {
this.restDocs = restApiDocsData;
}
+
+ navLinkClick( event ) {
+ this.navLinkClickEvent.emit( event );
+ }
}
diff --git a/frontend/src/app/components/docs/api-docs.component.html b/frontend/src/app/components/docs/api-docs.component.html
index 673691763..e043064db 100644
--- a/frontend/src/app/components/docs/api-docs.component.html
+++ b/frontend/src/app/components/docs/api-docs.component.html
@@ -4,7 +4,7 @@
@@ -16,7 +16,7 @@
@@ -26,7 +26,7 @@
-1 )" class="endpoint-container" id="{{ item.fragment }}">
-
+
Endpoint
diff --git a/frontend/src/app/components/docs/api-docs.component.ts b/frontend/src/app/components/docs/api-docs.component.ts
index 39617cdea..706d05fdb 100644
--- a/frontend/src/app/components/docs/api-docs.component.ts
+++ b/frontend/src/app/components/docs/api-docs.component.ts
@@ -3,6 +3,7 @@ import { Env, StateService } from 'src/app/services/state.service';
import { Observable, merge, of } from 'rxjs';
import { SeoService } from 'src/app/services/seo.service';
import { tap } from 'rxjs/operators';
+import { ActivatedRoute } from "@angular/router";
import { restApiDocsData, wsApiDocsData } from './api-docs-data';
@Component({
@@ -28,6 +29,7 @@ export class ApiDocsComponent implements OnInit {
constructor(
private stateService: StateService,
private seoService: SeoService,
+ private route: ActivatedRoute,
) { }
ngAfterViewInit() {
@@ -70,6 +72,13 @@ export class ApiDocsComponent implements OnInit {
});
}
+ scrollSameId( event: any ) {
+ const targetId = event.target.hash.substring(1);
+ if( this.route.snapshot.fragment === targetId ) {
+ document.getElementById( targetId ).scrollIntoView();
+ }
+ }
+
wrapUrl(network: string, code: any, websocket: boolean = false) {
let curlResponse = [];