Whenever I navigate between different routes in my AngularJS app, I encounter an issue with document.ready. It only seems to work when I do a hard refresh (ctrl+f5); navigating between pages does not trigger the ready state of the document.
Controller
angular.element(document).ready(function() {
window.scrollTo(0,90);
});
Main html file
<!DOCTYPE html >
<html ng-app="myApp">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title></title>
</head>
<body>
<div class="container">
<div ng-view></div>
</div>
</body>
</html>
app file
var mainModule = angular.module('myApp', ['ui.bootstrap.dialog']);
function viewServiceConfig($routeProvider) {
$routeProvider.
when('/', {
controller: SomeController,
templateUrl: 'somehtml.html'
}).
when('/someroute', {
controller: SomeRouteController,
templateUrl: 'someroutehtml.html'
}).
otherwise({
redirectTo: '/'
});
}
mainModule.config(viewServiceConfig);