I would like to bind an eventhandler to my ons-carousel postchange event in my AngularJS controller, however I keep getting an Uncaught TypeError: Cannot read property 'on' of undefined.
I try to access my carousel through its var attribute from my controller:
$scope.myCarousel.on('postchange', function() {
// do something
});
and my carousel is declared in my view:
<ons-carousel var="myCarousel" swipeable overscrollable auto-scroll>
...
</ons-carousel>
It works, however i can't access the variable myCarousel and can't bind the event to it. What am I doing wrong?