/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes} checked by tsc
 */
import { Directive, Input, HostListener } from '@angular/core';
import { NgModel } from '@angular/forms';
var ModelValidatorDirective = /** @class */ (function () {
    function ModelValidatorDirective() {
    }
    /**
     * @return {?}
     */
    ModelValidatorDirective.prototype.click = /**
     * @return {?}
     */
    function () {
        if (this.uiValidateModel) {
            if (!this.uiValidateModel.valid) {
                var /** @type {?} */ control = this.uiValidateModel.formDirective.controls[this.uiValidateModel.name];
                control.markAsDirty();
                control.markAsTouched();
            }
        }
    };
    ModelValidatorDirective.decorators = [
        { type: Directive, args: [{
                    selector: '[ui-validate-model]'
                },] },
    ];
    /** @nocollapse */
    ModelValidatorDirective.propDecorators = {
        "uiValidateModel": [{ type: Input, args: ['ui-validate-model',] },],
        "click": [{ type: HostListener, args: ['click',] },],
    };
    return ModelValidatorDirective;
}());
export { ModelValidatorDirective };
function ModelValidatorDirective_tsickle_Closure_declarations() {
    /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
    ModelValidatorDirective.decorators;
    /**
     * @nocollapse
     * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>}
     */
    ModelValidatorDirective.ctorParameters;
    /** @type {!Object<string,!Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
    ModelValidatorDirective.propDecorators;
    /** @type {?} */
    ModelValidatorDirective.prototype.uiValidateModel;
}

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kZWwtdmFsaWRhdG9yLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YW5iby91aS1uYXRpdmUvIiwic291cmNlcyI6WyJsaWIvZm9ybXMvbW9kZWwtdmFsaWRhdG9yLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQUU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