scrollSpyService.getObservable('window') returns Undefined
DaEkstrim opened this issue · comments
DaEkstrim commented
When I call the getObservable('window') in the ScrollSpyService, the service is returning 'undefined'. Can you please point out what the issue mightbe? Here's my setup:
Module:
import { ScrollSpyModule } from 'ng2-scrollspy';
...
@NgModule({
imports: [
ScrollSpyModule.forRoot(),
Component:
import { ScrollSpyService } from 'ng2-scrollspy';
...
constructor(private scrollSpyService: ScrollSpyService) {
}
...
ngAfterViewInit() {
console.log(this.scrollSpyService.getObservable('window'));
}
DaEkstrim commented
Upon further analysis of the documentation, I found that I was omitting the ScrollSpyDirective from the template. Once added, the function getObservable('window') returns an object correctly.