JoshDSommer / nativescript-ngx-slides

A NativeScript + Angular module for to add a slides component to your mobile app
Other
45 stars 34 forks source link

Late creation of slides, e.g., after receiving the response of a HTTP request #3

Closed heese closed 7 years ago

heese commented 7 years ago

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:

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.

Thank you!

heese commented 7 years ago

Works for me now.