3

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!

1
  • @StenMuchow New to SO so didn't know we could do that. Thanks for making me aware! Commented Jun 25, 2015 at 22:57

1 Answer 1

7

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
        }

    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.