code: function(translateAttr, translationId, scope, interpolateParams, defaultTranslationText) {
            if (translationId) {
              $translate(translationId, interpolateParams, translateInterpolation, defaultTranslationText)
                .then(function (translation) {
                  applyTranslation(translation, scope, true, translateAttr);
                }, function (translationId) {
                  applyTranslation(translationId, scope, false, translateAttr);
                });
            } else {
              // as an empty string cannot be translated, we can solve this using successful=false
              applyTranslation(translationId, scope, false, translateAttr);
            }
          }
docs: Put translation processing function outside loop