all files / src/components/map/ max-size.directive.ts

42.11% Statements 8/19
100% Branches 0/0
28.57% Functions 2/7
42.11% Lines 8/19
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 29                                         
"use strict";
var MaxSize = (function () {
    function MaxSize($timeout, $window) {
        this.restrict = 'A';
        this.require = 'openlayers';
        MaxSize.prototype.link = function (scope, iElement, iAttrs, olCtrl) {
            var resize = function () {
                iElement.css('height', '0px');
                iElement.css('height', iElement.parent()[0].getBoundingClientRect().height + 'px');
                olCtrl.getOpenlayersScope().getMap().then(function (map) {
                    map.updateSize();
                });
            };
            $timeout(resize);
            $window.addEventListener('resize', resize);
        };
    }
    MaxSize.Factory = function () {
        var directive = function ($timeout, $window) {
            return new MaxSize($timeout, $window);
        };
        directive['$inject'] = ['$timeout', '$window'];
        return directive;
    };
    return MaxSize;
}());
exports.MaxSize = MaxSize;