Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

I am new to AngularJS and Angular UI Router. I am wanting to decorate and call angular ui router's $uiViewScroll from javascript code but cannot figure out how to do so. Can someone please help me figure this out?

For the decoration part I have found: Angular ui-router scroll to top, not to ui-view

Thanks in advance!

share|improve this question
    
seems like you should accept this answer – Sten Muchow Jun 25 at 21:53
    
@StenMuchow New to SO so didn't know we could do that. Thanks for making me aware! – msmt Jun 25 at 22:57
    
No problem! Thanks for accepting! – Sten Muchow Jun 26 at 11:33

1 Answer 1

up vote 3 down vote accepted

Here is a small example how you can get it to fire.

'use strict';

angular.module('Directives.ScrollTop', [])

    .directive('scrollTop', function($uiViewScroll) {

        var linker = function (scope, element, attr) {

            $uiViewScroll(element);

        };

        return {
            restrict: 'A',
            link: linker
        }

    });
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.