Angular js form validation without html form

81 Views Asked by At

I have an input tag

                                    <div class="form-group" ng-form name="patientLinkingForm">
                                        <input type="text" class="form-control"
                                               ng-model="formData.parameters.otherRelationshipText" ng-pattern="/^[a-zA-Z. ]+$/" maxlength="100" name="otherRelationshipText">
                                        <span ng-show="patientLinkingForm.otherRelationshipText.$error.pattern"> my msg </span>
                                    </div>

and a button outside the div.

                        <button class="btn btn-primary btn-space" id="patientLinkingSM_linkBtn">
                                my button
                        </button>

Now I want to display the message in span only when the button is clicked , and I am using angular js form validation without the actual html form.

Please help me how to display the span when the button is clicked. I can do that with $submitted if my div is in html form tag here I have done that it worked.

 <span ng-show="myform.$submitted && myform.otherRelationshipText.$error.pattern"> my msg <span/>

But now there is no html form defined , how to do it without html form tag.

Thank you.

0

There are 0 best solutions below