Topic: ScrollSpy smootscrool, and activeLinkChange()
Karman40 priority asked 4 years ago
My nav link html:
<li class="nav-item" (click)="nav.toggle()">
<a class="nav-link waves-light" mdbScrollSpyLink="profile" mdbWavesEffect>Szolgáltatások</a>
</li>
<li class="nav-item" (click)="nav.toggle()">
<a class="nav-link waves-light" mdbScrollSpyLink="benefit" mdbWavesEffect>Előnyök</a>
</li>
<li class="nav-item" (click)="nav.toggle()">
<a class="nav-link waves-light" mdbScrollSpyLink="reference" mdbWavesEffect>Referenciák</a>
</li>
<li class="nav-item" (click)="nav.toggle()">
<a class="nav-link waves-light" mdbScrollSpyLink="about" mdbWavesEffect>Cégünkről</a>
</li>
<li class="nav-item" (click)="nav.toggle()">
<a class="nav-link waves-light" mdbScrollSpyLink="contact" mdbWavesEffect>Elérhetőségek</a>
</li>
</ul>
My nav .ts file:
getActiveLink(event: any): void {
console.log('event', event);
}
This is log nothing, but navigate to section. I tried to add href="#any"
, but also dosen't work.
Please help me, if i want to use smoot scrool how can i do it?
Closed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Angular
- MDB Version: 10.0.0
- Device: all
- Browser: all
- OS: all
- Provided sample code: Yes
- Provided link: No
Arkadiusz Idzikowski staff commented 4 years ago
Could you provide more information on the solution you would like to get? The scroll spy component only have an
activeLinkChange
output.You can find information about the Smooth Scroll usage in our documentation: https://mdbootstrap.com/docs/angular/advanced/scroll/
Karman40 priority commented 4 years ago
Sorry, my full code is here: (nav.html)
nav.ts:
guio
Karman40 priority commented 4 years ago
I want to use Page Scroll, but i get this error:
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(HomeModule)[PageScrollService -> PageScrollService -> PageScrollService -> PageScrollService]: NullInjectorError: No provider for PageScrollService! NullInjectorError: R3InjectorError(HomeModule)[PageScrollService -> PageScrollService -> PageScrollService -> PageScrollService]: NullInjectorError: No provider for PageScrollService!
Ok i import this service, but doc say nothing
Arkadiusz Idzikowski staff commented 4 years ago
Is there a problem only with the
activeLinkChange
event or the scrollspy doesn't work at all? Please note that themdbScrollSpyElement
directive should be used to spy on the internal scroll of the specific element. If you want to spy on the main page scroll, you should usemdbScrollSpyWindow
like in this example:https://mdbootstrap.com/docs/angular/navigation/scrollspy/#dotted-scrollspy