-3
 angular.module('example').service('myService', function
 myService($rootScope,$route,$http,$location) {                          
    $("#mainwindowscroll").on('scroll', function (e) {
          $location.path('/about');
    });
 });
Lucky
  • 16,787
  • 19
  • 117
  • 151
Niraj Kashyap
  • 232
  • 2
  • 8

2 Answers2

0

The first reason it doesn't work is - jquery is not part of angular digest mechanism.
To make it work you should apply the location change:

$rootScope.$apply(function() {
    $location.path('/about');
});

Also, make sure the location (/about) is defined in your app module. Otherwise you can use

$window.location('about')

to navigate to a complete different path (don't forget injecting $window of course).

Tomer
  • 4,382
  • 5
  • 38
  • 48
  • thanks. location (/about) is defined in my app module. I tried `$rootScope.$apply(function() { $location.path('/about'); }); ` that solve the issue thanks again – Niraj Kashyap Aug 20 '14 at 07:05
0

Please make sure that you have configured the routing for the navigation url '/about'?

oliholz
  • 7,447
  • 2
  • 43
  • 82
Archana
  • 387
  • 1
  • 5