Comments (8)
Hi, please check version 0.8.1
from ngx-gallery.
HI, I checked version 0.8.1 and I am not sure what am I to do, I update galleryImages, but nothing happens.
from ngx-gallery.
I have added example "14. Change Images" on demo page https://lukasz-galka.github.io/ngx-gallery-demo/ and as you can see everything is working fine.
You can check code for demo page here https://github.com/lukasz-galka/ngx-gallery-demo and here is app component https://github.com/lukasz-galka/ngx-gallery-demo/blob/master/src/app/app.component.ts
Maybe try to uninstall and install plugin again?
npm uninstall ngx-gallery
npm cache clear
npm install --save ngx-gallery
Let me know if it helps.
from ngx-gallery.
I tried reinstalling the plug-in, I cleared my cache, I rebuilt the project. Gallery doesn't update.
I do this throughout my code:
this.galleryImages.push({
'small': asset.url,
'medium': asset.url,
'big': asset.url,
'description': asset.shotCode.description
});
and I run this:
this.gallery.smallImages = this.galleryImages.map(img => img.small);
this.gallery.mediumImages = this.galleryImages.map(img => img.medium);
this.gallery.bigImages = this.galleryImages.map(img => img.big);
this.gallery.descriptions = this.galleryImages.map(img => img.description);
immediately after, otherwise the gallery will not update.
Does your code account for the following cases:
-Append an array (push/unset) ?
-replace an element in Array (this.galleryImages[0] = newImage;)
from ngx-gallery.
Yes, you are right, it is not working for push/unset or replace. It is because of angular change detection:
"During change detection, when Angular checks components' input properties for change, it uses (essentially) === for dirty checking. For arrays, this means the array references (only) are dirty checked."
from http://stackoverflow.com/a/34799257/5946227
I will take a look on ngDoCheck https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html#!#docheck and try implement custom login for change detection.
from ngx-gallery.
As you can see my use case does require checks to see if the array has been pushed/unset, or had elements replaced. Is there a temporary workaround for this issue?
Thanks
from ngx-gallery.
As described here http://stackoverflow.com/a/34799257/5946227
"Assign a new array to rawLapsData whenever you make any changes to the array contents. Then ngOnChanges() will be called because the array (reference) will appear as a change."
You have to create new array on every push/unset/update. For example:
This will not work:
this.galleryImages.push({
'small': asset.url,
'medium': asset.url,
'big': asset.url,
'description': asset.shotCode.description
});
but this should work:
let newImages = this.galleryImages.slice(0, this.galleryImages.length);
newImages.push({
'small': asset.url,
'medium': asset.url,
'big': asset.url,
'description': asset.shotCode.description
});
this.galleryImages = newImages;
from ngx-gallery.
Thank you so much for fixing this issue!
from ngx-gallery.
Related Issues (20)
- Close image preview programatically HOT 2
- ngx-gallery first time images loading is very slow.
- Preview Download Option To Open In Blank Window
- I need to pass a token authorization (bearer). HOT 16
- How to make "thumbnails on right" gallery with ngx-gallery HOT 1
- Can only see 1 rotate option for rotate images
- It's giving error in angular10 as showing 'Renderer2' is declared here. HOT 10
- I cannot add images coming from my backend Data into Image Array.
- Server Side Rendering (SSR)
- Angular 10 Error HOT 4
- z-index is too high HOT 1
- Angular (10) SSR Support for GalleryOption ImageAutoPlay (loading infinity) HOT 2
- preview open : get index of image opened and cancel preview opening?
- only upload small images
- It's giving error in angular11+ as showing 'Renderer2' is declared here. HOT 1
- Class NgxGalleryModule is not an Angular module with Angular 12 HOT 1
- Show method does not change the image regularly!
- Warning: Css Minimizer Plugin: - ANGULAR 12 - warning: Unexpected "/"
- Error: BrowserModule has already been loaded. HOT 2
- This likely means that the library (@ngx-gallery) which declares NgxGalleryModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-gallery.