Photoswipe with Angular


#1

I am having a problem with Photoswipe and Angular. Basically what I’m doing is get the images from my server doing $http.post and then pushing that objects into my array of images, then I’m initializing Photoswipe.

I get an error: Code.PhotoSwipe.createInstance: No images to passed., so the initialize is getting fired before all my items are in the view.

I am getting all the images in my view but, any idea of how can I initialize it only after all my images are in the view?

Thanks!


#2

How did you manage to initialize photoSwipe? I put a simple codepen together [here][1].
My problem is:

Uncaught TypeError: Cannot read property 'nodeName' of undefined 

I guess it could be the same isssue, the photoswipe being initilized beforoe the images are in the dom. And maybe the ionic.DomUtil.ready could be a solution?
[1]: http://codepen.io/gabberr/pen/CandK


#3

I’m having the same problem trying to implement it. Any solutions yet? Much thanks!


#4

Could you post your code into codepen ?


#5

try instantiating your plugin inside $ionciPlatform.ready (inside your controller)

$ionicPlatform.ready(function() {
  // init photoswipe
});