I read some Stackoverflow posts how to reset a form, but I doesn't get it. The input was valid but the error message was shown. Debugging the application shows me that the message gets a style="opacity: 1;margin-top: 0px;", but I have no idea from where.
<md-input-container flex style="margin-top: 0;margin-bottom: 5px">
<label translate>maintenanceMessage.description</label>
<input md-maxlength="40" required name="description" md-no-asterisk
ng-model="maintenanceMessageCtrl.newMaintenanceMessage.description" flex>
<div ng-messages="maintenanceMessageForm.description.$error" ng-if="maintenanceMessageForm.description.$touched">
<div ng-message="required" translate>maintenanceMessage.description.requiredMessage</div>
<div ng-message="md-maxlength" translate>maintenanceMessage.description.maxLengthMessage</div>
</div>
</md-input-container>
on reset I execute following function
ctrl.resetFormAndHideDialog = function () {
ctrl.newMaintenanceMessage = {};
ctrl.newMaintenanceMessage.expirationDate = new Date();
ctrl.showLastModification = false;
$scope.maintenanceMessageForm.$setUntouched();
$scope.maintenanceMessageForm.$setPristine();
$mdDialog.hide();
};
Am I missing something?
Thanks for helping.
Conclusio: It seems that angular material 1.1.1 has a bug. So ng-message wasn't hidden.