Checking array for tags
Here's a rewrite that clarifies and shortens the code.  A few of its advantages:


Removes nested if... else statements
Replaces vague variable name data with something more descriptive.
Names the concepts you are implicitly using in your code (eg, "checkedSave" means "check if it's valid to save the tag, then save it").  We also name the various conditions we are interested in: noSavedTags and tagAlreadyExists.
Avoid unnecessary indendation by not defining our callback saveOrRemoveTag inline.
Avoid verbose, unsightly for loop by using using map and indexOf to check if the tag already exists.
User ternary operator instead of if... else to express simple conditional expressions.


The new code:

function processTag(total, tag, associatedTicker) {

    TagFactory.retrieveTickerTags('onlyTags').then(saveOrRemoveTag);

    function saveOrRemoveTag(savedTags) {

        var noSavedTags = savedTags.length == 0;
        if (noSavedTags) { checkedSave(); return; }

        tagAlreadyExists() ? removeTag(tag, associatedTicker) : checkedSave();

        // the 3 lines above are really the entire function
        // everything below is just helper functions

        function checkedSave() {
            total &lt; 3 ? saveTag(tag, associatedTicker)
                      : displayAlert('failure', 'Only 3 tags can be monitored at a time.');
        }

        function tagAlreadyExists() {
            var existingTermIds = savedTags.map(function(t) { return t.term_id });
            return existingTermIds.indexOf(tag.term_id) &gt; -1;
        }
    }
}