So using angular-spinner angular-spinner githubi have created a directive that connects with a factory that is using a $http.interceptorUsing this i am able to use the Observer design pattern to listen for when data has been collected for a given route in my ApiThe code looks something like this:responseInterceptor Factoryangular.module('Api').factory('responseInterceptor', function () {    var routeSubscribers = {};    function notifyRouteSubscribers(route) {        if (routeSubscribers[route]) {            while (routeSubscribers[route].length) {                routeSubscribers[route].pop()();            }        }    }    return {        response: function (response) {            if (response.config.url.indexOf('api') >= 0) {                var myRegexp = /[^\/]+$/g;                var match = myRegexp.exec(response.config.url);                notifyRouteSubscribers(match[0]);            }            return response;        },        subScribeToRoute: function (route, callback) {            if (routeSubscribers[route]) {                routeSubscribers[route].push(callback);            }            else {                routeSubscribers[route] = [callback];            }        }    }});contentSpinner directiveangular.module('Api').directive('contentSpinner', function (responseInterceptor,$timeout) {    return {        restrict: 'E',        templateUrl: 'js/helpers/Api/directives/content-spinner/content-spinner.html',        scope: {            boundRoute: '@',            timeout: '=',            timeoutms: '@'        },        link: function (scope, element, attr) {            scope.shouldSpin = true;            if (scope.boundRoute) {                responseInterceptor.subScribeToRoute(scope.boundRoute, function () {                    //Route has been completed and the spinner is ready to stop!                    scope.shouldSpin = false;                })            }            if (scope.timeout) {                $timeout(function () {                    scope.shouldSpin = false;                }, scope.timeoutms);            }        }    }});What i am worried about with this code is that when my application grows will this still be a viable way to do it? :) Hope some of you can give me a review :D
Angular spinner combined with a response interceptor
javascript;angular.js