Angular AutoScroll not working

7 views
Skip to first unread message

Roberto Flores

unread,
May 18, 2018, 1:16:20 AM5/18/18
to Angular and AngularJS discussion
I am unable to get the autoscroll to work on android devices, especially samsung s6 and above (using s7 and doesnt work)

The following is my controller:

function(){
var $scope, $location, $anchorScroll;
var indexApp = angular.module('indexApp',['ui.bootstrap', 'ngSanitize']);

indexApp.controller('IndexController',function($scope,$http,$location,$anchorScroll,anchorSmoothScroll){
$scope.Lang = 'initVal';
$scope.ShowResults = false;
$scope.ShowDesc = true;
$scope.NoResults = false;
$scope.currentPage = 1;
$scope.maxPageNumbersToShow = 10;
$scope.formModel = {};
$scope.searchMode = 0;
$scope.miles = [{'value':'5'},{'value':'10'},{'value':'15'},{'value':'20' }];
$scope.Specialties = [{'value':'Family practice'},{'value':'General practice'},{'value':'Internal medicine'},{'value':'Pediatrics'}];
$scope.Gender = [{'value':'Male'},{'value':'Female'}];
//$scope.Languages = {};
$scope.Cities = {};
$scope.searchParam = {};
$("input").removeAttr('disabled');
$scope.searchParam.Distance = $scope.miles[0];


And the following is where I check if it is a mobile device and if it is, autoscroll to results. Any help would be appreciated as I am stumped with why it works on some devices and not for Samsung s6 or other android devices
$scope.providers = response.data.provider;
$scope.resultsCount = response.data.rowCount;
if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/) || 
navigator.userAgent.match(/Windows Phone/i) || navigator.userAgent.match(/ZuneWP7/i) || navigator.userAgent.match(/SAMSUNG|SGH-[I|N|T]|GT-[I|P|N]|SM-[N|P|T|Z|G]|SHV-E|SCH-[I|J|R|S]|SPH-L/i)) {
if (!$scope.providers){
$scope.NoResults = true;
$scope.ShowResults = false;
$scope.ShowDesc = false;
$location.hash('error');

// call $anchorScroll()
$anchorScroll('error');
}
else {
$scope.NoResults = false;
$scope.ShowResults = true;
$scope.ShowDesc = false;
$location.hash('ResultsAnchor');

// call $anchorScroll()
$anchorScroll('ResultsAnchor');
}
}
else{
if (!$scope.providers){
$scope.NoResults = true;
$scope.ShowResults = false;
$scope.ShowDesc = false;
}
else {
$scope.NoResults = false;
$scope.ShowResults = true;
$scope.ShowDesc = false;
}
}
Reply all
Reply to author
Forward
0 new messages