Hy.
I will worked with angularjs but i have a little problem. It was my first App!
When I change route scroll to top not working.
//index.html
<body ng-app="WebApp">
<div class="wrapper" >
<div ng-include='"templates/sidebar.html"'></div>
<div class="main-panel">
<div ng-include='"templates/header.html"'></div>
<div ng-view ></div>
</div>
</div>
</body>
And my js file:
//app.js
var app = angular.module('WebApp', [
'ngRoute','ui.bootstrap'
]);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider
// Home
.when("/", {templateUrl: "partials/home.html", controller: "PageCtrl"})
// Pages
.when("/page_two", {templateUrl: "partials/page2.html", controller: "PageCtrl"})
.when("/404", {templateUrl: "partials/404.html", controller: "PageCtrl"})
.otherwise({ redirectTo: '/404'});
}]).run(['$rootScope', '$location', function($rootScope, $location){
var path = function() { return $location.path();};
$rootScope.$watch(path, function(newVal, oldVal){
$rootScope.activetab = newVal;
});
}]);
app.controller('PageCtrl', function (/* $scope, $location, $http */) {
});
I have tried window.scrollto in run -- not working. I have add autoscroll to ng-view and also not working. Here on stackoverflow works this for evryone but not for me? can anyone help?