@TheOriginalJosh I pulled the current version of nativescript-ng2-slides and played around with it. I have probably found a way to solve the use case 'late creation of slides'.
What I did:
I created a method manualInit() in SlidesComponent and moved the code from ngAfterViewInit to this new method.
In AppComponent I implemented ngAfterViewChecked and checked if the slides view has children. If yes, then I call manualInit().
However, this implementation is not very nice. I can imagine that SlidesComponent implements ngAfterViewChecked and checks every time it is called if the number of children has changed (= very basic way of detecting new slides). If the number has changed then SlidesComponent initialises its internal data structures.
Since I am not an expert regarding nativescript and angular, and you know your code better than me I would appreciate if you could add this behaviour to your library -- that is if it makes sense to you.
I attach the files contained in the folder slides/app of your project (except for the folder App_Resources) so you can have a look and give it a go: app.zip
Please let me know if you are unable to work on it till next Wednesday -- I need to finish my app very soon.
This issue continues the discussion started at https://github.com/TheOriginalJosh/nativescript-slides/issues/37#issuecomment-266632873
@TheOriginalJosh I pulled the current version of nativescript-ng2-slides and played around with it. I have probably found a way to solve the use case 'late creation of slides'.
What I did:
manualInit()
inSlidesComponent
and moved the code fromngAfterViewInit
to this new method.AppComponent
I implementedngAfterViewChecked
and checked if the slides view has children. If yes, then I callmanualInit()
.However, this implementation is not very nice. I can imagine that
SlidesComponent
implementsngAfterViewChecked
and checks every time it is called if the number of children has changed (= very basic way of detecting new slides). If the number has changed thenSlidesComponent
initialises its internal data structures.Since I am not an expert regarding nativescript and angular, and you know your code better than me I would appreciate if you could add this behaviour to your library -- that is if it makes sense to you.
I attach the files contained in the folder
slides/app
of your project (except for the folderApp_Resources
) so you can have a look and give it a go: app.zipPlease let me know if you are unable to work on it till next Wednesday -- I need to finish my app very soon.
Thank you!