Angular.js and PrettyPhoto (external modal popup library) help needed

1,258 views
Skip to first unread message

webster

unread,
Apr 5, 2012, 4:52:29 PM4/5/12
to AngularJS
Hi all,

I'm working on a project with angular and I'm really struggling to
make my view and corresponding controller open up pretty photo modal
window when link is clicked (PrettyPhoto (documentation here
http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentation/))

Sample pretty photo call from javascript:

$.prettyPhoto.open('images/fullscreen/
image.jpg','Title','Description');

Guess the scope is the problem. Is there any way to pass prettyphoto
to current controller so when I type $.prettyPhoto.open() it sees it.

Thanks all, so far it's been a pleasure using this framework.


webster

unread,
Apr 5, 2012, 5:25:30 PM4/5/12
to AngularJS
Forgot to mention, i'm using partials for the views, don't know if
that makes any difference.

webster

unread,
Apr 5, 2012, 11:57:26 PM4/5/12
to ang...@googlegroups.com
Guess the crucial part was $window, I accessed it with following:

$window.$.fn.prettyPhoto();

Not sure if it's the best way, but it did it. Just in case someone else is looking for something similar.




Misko Hevery

unread,
Apr 6, 2012, 12:48:14 AM4/6/12
to ang...@googlegroups.com
You should have a method in the controller called showPhoto and then in the view simply call that method. The ShowPhoto would then call the $.fn.prettyPhoto();





--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/qedHgiBm8xMJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Matej Poklukar

unread,
Jul 30, 2013, 8:47:33 AM7/30/13
to ang...@googlegroups.com
Hi webster, 

did you solve this problem? If yes, would you share your code? I'm facing sam problem and I cannot find solution...

Matej
Reply all
Reply to author
Forward
0 new messages