Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

ngScrollSpy with ng-route #6

Closed
cyrusn opened this issue Nov 23, 2014 · 1 comment
Closed

ngScrollSpy with ng-route #6

cyrusn opened this issue Nov 23, 2014 · 1 comment

Comments

@cyrusn
Copy link

cyrusn commented Nov 23, 2014

Hi, I am using angular-route together with ngScrollSpy, but find that the hash link won't work with angular-route, I try to use this link to solve the problem, and It seems work too, but want to see if there is another better method.
Here is what I added in ngScrollSpy.js

// ln: 497
// markup += '<a href="#' + $location.path() +'/#'+ item.link + '">';
      markup += '<a href="" ng-click="scrolltoHref(' + "'" +item.link + "'" +')">';

and add a controller to the directive

    controller: function ($scope) {
      $scope.scrolltoHref = function(id){
        $location.hash(id);
        $anchorScroll();
      };
    },
@cyrusn
Copy link
Author

cyrusn commented Nov 24, 2014

Oh, sorry. Just find that there are a pull-request by jaroslavrehorka that can solve my problem, and That work great too. Thanks

#5

@cyrusn cyrusn closed this as completed Nov 24, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant