How to show ng-message when submit or lose focus with out exact some button click(cancel button)
<p>I have form on a dialog with some input field and a submit, a cancel buttons. I use ng-message for show input is wrong. But when i click cancel with ng-click="$dismiss()" for disable dialog then ng-message is show and action dismiss() is terminate. Some suggestion for me to resolve case</p>

<pre><code>&lt;form name="accountGroupForm" novalidate&gt;
            &lt;div class="form-group"
                 &gt;

                &lt;input id="group-name" class="form-control" name="groupName" placeholder="{{'Group name' | translate}}"
                       ng-model="accountGroup.name" ng-focus="true"
                       required&gt;

                &lt;div ng-messages="accountGroupForm.groupName.$error" ng-if="accountGroupForm.groupName.$touched"&gt;
                    &lt;div ng-message="required" class="help-block"&gt;&lt;span translate&gt;Group name is required&lt;/span&gt;&lt;/div&gt;

                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="wrapper row"&gt;
                &lt;div class="col-xs-6 text-right p-r-xs"&gt;
                    &lt;button type="submit" class="hvr-grow btn btn-success w-sm"
                            ng-disabled="accountGroupForm.$invalid"
                            ng-click="submitAccountGroup()" translate&gt;
                        Ok
                    &lt;/button&gt;
                &lt;/div&gt;
                &lt;div class="col-xs-6 text-left p-l-xs"&gt;
                    &lt;button class="hvr-grow btn btn-grey-blue w-sm" ng-click="$dismiss()" translate&gt;Cancel
                    &lt;/button&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/form&gt;
</code></pre>