angular
.module('portal', dependencies)
.run(['$rootScope', '$http', 'ngProgress', 'NotifyService', function($rootScope, $http, ngProgress, Notify) {
ngProgress.color('#66afda');
$rootScope.pendingRequests = $http.pendingRequests;
$rootScope.$watch('pendingRequests', function(requests) {
ngProgress[requests.length !== 0 ? 'start' : 'complete']();
}, true);
$rootScope.$on('$routeChangeError', function() { Notify.error('An error occured when trying to change the current route!'); })
}]);
$routeProvider
.when('/application-:appId', {})
.when('/application-:appId/:portalViewId/:viewType-:viewId', {
controller: 'PortalViewCtrl',
reloadOnSearch: false,
templateUrl: function($routeParams) {
var viewType = $routeParams.viewType;
return (viewType && portalViewTypes.indexOf(viewType) > -1) && 'portal/portal-views/' + viewType + '/' + viewType + '-view.html';
}
})
.otherwise({redirectTo: '/'});
We're using ngTemplates Grunt plugin to check get all the templates and put them into $templateCache service.
Please note that all the template are included, the paths are correct within this service, everything works ok either by removing the ngProgress.color('#66afda');
line, or commenting out the line where the scope is manually applied (from ngProgress code).