# Wijmo_Angular_Core.Wjvalidationerror

## Content

<div class="content__tsd">
						<div style="display:flex;justify-content:space-between;align-items:center">
							<h1>
								WjValidationError Class
							</h1>
						</div>
						<section class="tsd-comment">
							<div class="tsd-comment">
								<div class="lead">
									<p>AngularJS directive for custom validations based on expressions.</p>
								</div>
								<p>The <b>wj-validation-error</b> directive supports both AngularJS and native HTML5
									validation mechanisms. It accepts an arbitrary AngularJS expression that should return
								an error message string in case of the invalid input and an empty string if the input is valid.</p>
								<p>For AngularJS validation it should be used together with the <b>ng-model</b> directive.
									In this case the <b>wj-validation-error</b> directive reports an error using a call
									to the <b>NgModelController.$setValidity</b> method with the <b>wjValidationError</b> error key ,
								in the same way as it happens with AngularJS native and custom validation directives.</p>
								<p>For HTML5 validation, the <b>wj-validation-error</b> directive sets the error state to the
								element using the <b>setCustomValidity</b> method from the HTML5 validation API. For example:</p>
								<pre>&lt;p&gt;HTML5 validation:&lt;/p&gt;
&lt;form&gt;
    &lt;input type="password"
        placeholder="Password"
        name="pwd" ng-model="thePwd"
        required minlength="2" /&gt;
    &lt;input type="password"
        placeholder="Check Password"
        name="chk" ng-model="chkPwd"
        wj-validation-error="chkPwd != thePwd ? 'Passwords don\'t match' : ''" /&gt;
&lt;/form&gt;

&lt;p&gt;AngularJS validation:&lt;/p&gt;
&lt;form name="ngForm" novalidate&gt;
    &lt;input type="password"
        placeholder="Password"
        name="pwd" ng-model="thePwd"
        required minlength="2" /&gt;
    &lt;input type="password"
        placeholder="Check Password"
        name="chk" ng-model="chkPwd"
        wj-validation-error="chkPwd != thePwd" /&gt;
    &lt;div
        ng-show="ngForm.chk.$error.wjValidationError &amp;&amp; !ngForm.chk.$pristine"&gt;
        Sorry, the passwords don't match.
    &lt;/div&gt;
&lt;/form&gt;</pre>
							</div>
						</section>
						<section class="tsd-hierarchy">
							<h3>Heirarchy</h3>
							<ul class="tsd-hierarchy">
								<li>
									<span class="tsd-signature-type">WjDirective</span>
									<ul class="tsd-hierarchy">
										<li>
											<span class="target">WjValidationError</span>
										</li>
									</ul>
								</li>
							</ul>
						</section>
					</div>