I am trying to bind a scroll for an image so that based on the scroll position I can change the value of $ scope. However, what I am doing is breaking value binding. Here's the JSFiddle:
http://jsfiddle.net/h2popz9t/
$scope.testFun = function(a) {
if (a.target.scrollLeft < 100) {
$scope.something.yes = true;
} else if (a.target.scrollLeft > 100) {
$scope.something.yes = false;
}
};
b.bind('scroll', $scope.testFun);
When "something.yes" changes (because you scrolled 100px), it should call "ng-show" in the div with the text "SOMETHING". Not this. Although, I know that they are connected initially, because something.yes has the correct value at startup.
I'm not sure how I messed up the binding to "$ scope.something"
source
share