Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Pattern to combine ngProgress and ui router
'use strict';
angular.module('something', [
.config(function($locationProvider) {
.config(function($provide) {
return $provide.decorator('$uiViewScroll', function($delegate, $window) {
return function(uiViewElement) {
//eventually do something more intelligent with the uiViewElement
return $window.scrollTo(0, 0);
}).run(function($injector, ngProgress) {
var $rootScope = $injector.get('$rootScope');
// Sets the height of the progressbar. Use any valid CSS value Eg '10px', '1em' or '1%'.
// ngProgress.height();
// Sets the color of the progressbar and it's shadow. Use any valid HTML color
// ngProgress.color();
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState) {
$rootScope.$on('$stateChangeSuccess', function() {
$rootScope.$on('$stateChangeError', function() {

This comment has been minimized.

Copy link

mudassir0909 commented Nov 10, 2015

This doesn't work since ngProgress isn't instantiated inside

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.