<commit_before>define([
    'directives/module'
], function(directives) {
    'use strict';

    directives.directive('errImgSrc', function() {
        return {
            restrict: 'A',
            link: function(scope, element, attributes) {
                attributes.$observe('ngSrc', function(value) {
                    if(!value) {
                        attributes.$set('src', 'media/images/no-img.jpg');
                    }
                });
            }
        };
    });
});<commit_msg>Added image fallback handling for 404 responses.<commit_after>define([
    'directives/module'
], function(directives) {
    'use strict';

    directives.directive('errImgSrc', function() {
        return {
            restrict: 'A',
            link: function(scope, element, attributes) {
                var noImg = 'media/images/no-img.jpg';

                element.bind('error', function() {
                    if(attributes.src !== noImg) {
                        attributes.$set('src', noImg);
                    }
                });

                attributes.$observe('ngSrc', function(value) {
                    if(!value) {
                        attributes.$set('src', noImg);
                    }
                });
            }
        };
    });
});
{'fraction_non_alphanumeric': 0.1402961808261886, 'fraction_numerical': 0.002338269680436477, 'mean_word_length': 1.3430656934306568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4608239', 'n_tokens_mistral': 338, 'n_tokens_neox': 316, 'n_words': 53}