angularjs - Binding to a scroll event inside nested views -
i need track if top 300 pixels subview have scrolled out of visible area, cannot bind scroll event of view (but can bind 'resize'!)
location: index.html -> global layout -> content area -> subview (this one)
.state('my', { url: '/my', views: { '': { templateurl: 'app/views/layout.html' }, 'content': { templateurl: 'app/views/content.html' <-- inside view have ng-view, subtemplate loaded it. } },
important: not windowed / limited height view. has header, no footer, i.e. can length depending on contents length.
please help! d.
update
i've found following workaround. please let me know how ugly angularjs point of view?
var el = angular.element(document.getelementbyid('top')); $scope.$watch(function () { $timeout(function () { var top = el[0].getboundingclientrect().top; if (top < -160) { // doing } else { // doing } }); });
Comments
Post a Comment