I am trying to change top position of a DIV on Scroll event -
In controller i have-
angular.element($window).on("scroll", function(e) {
vm.scrollTop = angular.element($window).scrollTop()+'px';
console.log(vm.scrollTop);
});
In html -
<div ng-style="{'top': vm.scrollTop}">
Hello World
</div>
On scroll event is printing scrollTop values in console but "Div" style never gets updated.
Please correct me if this is syntactically incorrect.