Cannot find name 'ScrollSpyModule'.
kodiraj opened this issue · comments
i did as per the readme text .
when i try to start using npm,i get the below error
app/app.module.ts(19,5): error TS2304: Cannot find name 'ScrollSpyModule'.
I just updated readme.md with proper inputs for demos. My mistake sry.
Thanks .it solved the error.But new errors pop up.
You have working version of this.?
in my app.module.ts
import { ScrollSpyModule } from 'ng2-scrollspy';
@NgModule({
bootstrap: [App],
declarations: [
App
],
imports: [ // import Angular's modules
BrowserModule,
HttpModule,
RouterModule,
FormsModule,
ReactiveFormsModule,
ScrollSpyModule.forRoot(),
NgaModule,
PagesModule,
routing
],
providers: [ // expose our Services and Providers into Angular's dependency injection
ENV_PROVIDERS,
APP_PROVIDERS
]
})
in my page.module.ts
import { ScrollSpyElementDirective, ScrollSpyService } from 'ng2-scrollspy';
@NgModule({
imports: [CommonModule, NgaModule, routing],
declarations: [Pages,ScrollSpyElementDirective]
})
in my page.componenet.ts
import { ScrollSpyElementDirective, ScrollSpyService } from 'ng2-scrollspy';
export class Pages {
constructor(scrollSpyService: ScrollSpyService) {
this.scrollSpyService = scrollSpyService;
}
ngAfterViewInit() {
this.scrollSpyService.getObservable('test').subscribe((e: any) => {
console.log('ScrollSpy::test: ', e);
});
}
}
when i run through npm
[default] /Users/kodiraj/Downloads/nextgenportal1/src/app/pages/pages.component.ts:38:14
Property 'scrollSpyService' does not exist on type 'Pages'.
[default] /Users/kodiraj/Downloads/nextgenportal1/src/app/pages/pages.component.ts:42:14
Property 'scrollSpyService' does not exist on type 'Pages'.
[default] Checking finished with 5 errors
it would really help ,if you have some demo of this feature
in you pages.component.ts you should declare the scrollSpyService variable. One way is:
export class Pages {
constructor(private scrollSpyService: ScrollSpyService) {
}
ngAfterViewInit() {
this.scrollSpyService.getObservable('test').subscribe((e: any) => {
console.log('ScrollSpy::test: ', e);
});
}
}
hi,
Can you share some demo code if possible..
On Sep 21, 2016, at 7:43 PM, João Ribeiro notifications@github.com wrote:
I just updated readme.md with proper inputs for demos. My mistake sry.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #68 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AKzpwzL7BSV0GhSEM1gMIlk5pvBUqU2Bks5qsTucgaJpZM4KCY4H.
hi,
i have nested components.Here how should i handle it?
On Sep 26, 2016, at 7:31 PM, João Ribeiro notifications@github.com wrote:
in you pages.component.ts you should declare the scrollSpyService variable. One way is:
export class Pages {
constructor(private scrollSpyService: ScrollSpyService) {
}ngAfterViewInit() { this.scrollSpyService.getObservable('test').subscribe((e: any) => { console.log('ScrollSpy::test: ', e); }); }
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #68 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AKzpw7-XsRV87QpSGKYpydqngynDUGccks5qt9BMgaJpZM4KCY4H.
scrollSpyElement=“kodiraj"
i declared the above tag in only one place.
ScrollSpy: duplicate id "kodiraj". Instance will be skipped!
But i get the error in the console.
On Sep 26, 2016, at 7:31 PM, João Ribeiro notifications@github.com wrote:
in you pages.component.ts you should declare the scrollSpyService variable. One way is:
export class Pages {
constructor(private scrollSpyService: ScrollSpyService) {
}ngAfterViewInit() { this.scrollSpyService.getObservable('test').subscribe((e: any) => { console.log('ScrollSpy::test: ', e); }); }
}
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub #68 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AKzpw7-XsRV87QpSGKYpydqngynDUGccks5qt9BMgaJpZM4KCY4H.
Please try new version v0.3.0.
Make sure you read docs for new declaration system.
I will try to create more documentation and example during next week.