"use strict";
var angular = require("angular");
var _ = require("lodash");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var __array = typescript_angular_utilities_1.services.array;
var componentValidator_service_ng1_1 = require("../../services/componentValidator/componentValidator.service.ng1");
exports.moduleName = 'rl.ui.components.validationGroup';
exports.componentName = 'rlValidationGroup';
exports.controllerName = 'ValidationGroupController';
var ValidationGroupController = (function () {
    function ValidationGroupController($scope, $timeout, componentValidatorFactory) {
        this.$scope = $scope;
        this.$timeout = $timeout;
        this.componentValidatorFactory = componentValidatorFactory;
    }
    ValidationGroupController.prototype.$onInit = function () {
        var _this = this;
        this.$timeout(function () {
            _this.validators = __array.arrayUtility.arrayify(_this.validator).concat(__array.arrayUtility.arrayify(_this.validators));
            if (!_.isUndefined(_this.validator)) {
                _this.groupValidator = _this.componentValidatorFactory.getInstance({
                    form: _this.$scope.validationGroupForm,
                    $scope: _this.$scope,
                    validators: _this.validators,
                });
            }
        });
    };
    return ValidationGroupController;
}());
ValidationGroupController.$inject = ['$scope', '$timeout', componentValidator_service_ng1_1.factoryName];
exports.ValidationGroupController = ValidationGroupController;
var validationGroup = {
    transclude: true,
    template: require('./validationGroup.ng1.html'),
    controller: exports.controllerName,
    controllerAs: 'group',
    bindings: {
        validator: '<?',
        validators: '<?',
    },
};
angular.module(exports.moduleName, [componentValidator_service_ng1_1.moduleName])
    .component(exports.componentName, validationGroup)
    .controller(exports.controllerName, ValidationGroupController);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGlvbkdyb3VwLm5nMS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInZhbGlkYXRpb25Hcm91cC5uZzEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGlDQUFtQztBQUNuQywwQkFBNEI7QUFFNUIsNkVBQXdEO0FBRXhELElBQU8sT0FBTyxHQUFHLHVDQUFRLENBQUMsS0FBSyxDQUFDO0FBR2hDLG1I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