This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
ng-messages not showing inside $mdDialog #8037
Copy link
Copy link
Closed
Labels
P4: minorMinor issues. May not be fixed without community contributions.Minor issues. May not be fixed without community contributions.needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or communityThe cause of this issue is not well understood and needs to be investigated by the team or community
Description
In the following small example, validation works (red lines appear and disappear based on input), but the ng-message do not display.
<form name="addUnitForm" ng-submit="addUnit(unit.name)">
<md-input-container>
<label>Name</label>
<input name="name" type="text" ng-required="true" ng-model="unit.name" minlength="1" />
<div ng-messages="addUnitForm.name.$error">
<div ng-message-exp="['required', 'minlength']">Error message</div>
</div>
</md-input-container>
[...]
</form>
The same code works when not inside an $mdDialog directive, so my best guess is, the directive is messing things up. This is the code initializing the dialogue:
$scope.addUnit = function() {
$mdDialog.show({
templateUrl: 'templates/addUnit.html',
parent: angular.element(document.body),
scope: $scope,
clickOutsideToClose: true,
preserveScope: true,
controller: function(scope) {
[...]
}
});
}
Could it be related to my inheritance of the global $scope into the directive?
Metadata
Metadata
Assignees
Labels
P4: minorMinor issues. May not be fixed without community contributions.Minor issues. May not be fixed without community contributions.needs: investigationThe cause of this issue is not well understood and needs to be investigated by the team or communityThe cause of this issue is not well understood and needs to be investigated by the team or community