Code coverage report for ./src/client/app/widgets/ht-img-person.directive.js

Statements: 41.67% (5 / 12)      Branches: 0% (0 / 2)      Functions: 25% (1 / 4)      Lines: 41.67% (5 / 12)      Ignored: none     

All files » ./src/client/app/widgets/ » ht-img-person.directive.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291     1       1   1                     1                
(function () {
    'use strict';
 
    angular
        .module('app.widgets')
        .directive('htImgPerson', htImgPerson);
 
    htImgPerson.$inject = ['config'];
    /* @ngInject */
    function htImgPerson (config) {
        //Usage:
        //<img ht-img-person="{{person.imageSource}}"/>
        var basePath = config.imageBasePath;
        var unknownImage = config.unknownPersonImageSource;
        var directive = {
            link: link,
            restrict: 'A'
        };
        return directive;
 
        function link(scope, element, attrs) {
            attrs.$observe('htImgPerson', function (value) {
                value = basePath + (value || unknownImage);
                attrs.$set('src', value);
            });
        }
    }
})();