Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to integrate angularjs with galleria or supersize image galleries plugin.

My purpose to communicate with server on sliding of the image and the problem is that galleria has its own callbacks on different actions like on image change

Galleria.on('image', function(e) {
  Galleria.log(this); // the gallery scope
});

And the problem is that how the angular js controller functions will be notified on the image change.

Newbie in angular so may be this is silly question but tried a lot to figure it out but was unable to find any thing.

thanks

share|improve this question
add comment

1 Answer

If this within the callback is a DOM element you can access the scope from the controller that the element resides in using:

var controllerScope= angular.element(this).scope();
/* update a variable in scope*/
controllerScope.someVar=this.src;
/* use $apply() so angular reacts to update*/
controllerScope.$apply();

DEMO (using jQuery cycle plugin)

http://jsfiddle.net/RUTN5/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.