Sharing $scopes across Controllers with ScopeFactory Previously, I use to always navigate through the $parent $scopes in order to send or change data from one Controller into/in another. I then created my own ScopeFactory as a way to storing each Controllers $scope and then getting those scopes from other Controllers.

Having not experienced any problems with using this method, I'm just curious if this is a good way to do it.

.factory('ScopeFactory', [function() {

    var notifications  = { that: this };
    var tagsPanel      = { that: this };
    var activityHeader = { that: this };

    var saveScope = function(type, vs) {
        switch(type) {
            case 'notifications':
                notifications.that = vs;
                break;
            case 'tagsPanel':
                tagsPanel.that = vs;
                break;
            case 'activityHeader':
                activityHeader.that = vs;
                break;
        }
    };

    var getScope = function(type) {
        switch(type) {
            case 'notifications':
                return notifications.that;
                break;
            case 'tagsPanel':
                return tagsPanel.that;
                break;
            case 'activityHeader':
                return activityHeader.that;
                break;
        }
    };

    return {
        saveScope : saveScope,
        getScope  : getScope
    };
}]);


Saving a scope:

// inside activityHeader Controller:
ScopeFactory.saveScope('activityHeader', vs);


Getting a scope from another Controller:

var activityHeader = {};

activityHeader = ScopeFactory.getScope('activityHeader');
activityHeader.chosenTicker   = initTicker;
activityHeader.companyName    = compName;
activityHeader.currentPrice   = price;
activityHeader.currentPercent = percent;
activityHeader.initialTickerLoaded(ticker);
I've finally refactored out the anti-pattern ScopeFactory out of my apps.
Instead I'm using $broadcast and $emit to accomplish what I'm trying to do, which is the more Angular way of doing this.

Example
Controller 1 (I $emit out the event and send a variable):
$rootScope.$emit(&quot;add.ticker.typing&quot;, word);
Controller 2 (I listen for the event and pick it up, including variables like objects or strings):
$rootScope.$on(
    &quot;add.ticker.typing&quot;,
    function handleSearchTyping(event, word, option) {
        if (option != 'empty') {
            typingSearch(word);
        } else {
            $scope.tickersList       = [];
            $scope.tickersListLoaded = false;
        }
    }
);

Now with this, now only is it a true Angular pattern, but I'm not sending giant Controller $scope objects all around my app.