Enter code here... Enter code here...
How to get window scrolling function to work in Angularjs. Am migrating from jquery to angularjs. I need to convert this three line of codes from jquery to angularjs $(window).scroll(function(){ var position = $(window).scrollTop(); var bottom = $(document).height() - $(window).height(); Here is the working code for jquery which alerts position and bottom values <script> $(document).ready(function(){ $(window).scroll(function(){ var position = $(window).scrollTop(); var bottom = $(document).height() - $(window).height(); alert(position); alert(bottom); if( position == bottom ){ /* $.ajax({ url: 'fetch_data.php', type: 'post', data: {row:20}, success: function(response){ $(".post:last").after(response).show().fadeIn("slow"); } }); */ } }); }); </script> Here is my struggle with angularjs but cannot get it to work. Can someone help me <script> var fetch = angular.module('myapp', []); fetch.controller('fetchCtrl', ['$scope', '$http','$window', function ($scope, $http, $window) { angular.element($window).bind("scroll", function() { var position = $(window).scrollTop(); var bottom = $(document).height() - $(window).height(); alert(position); alert(bottom); if( position == bottom ){ /* $scope.getPosts = function(){ $http({ method: 'post', url: 'getData.php', data: {row:20} }).then(function successCallback(response) { $scope.posts = response.data; }); } */ } }); }]); </script> -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.