I came across this jade template for creating a modal dialog in Angular Material. Unfortunately, I couldn't convert it to HTML because the jade site was not working.
md-dialog(aria-label='Reject', ng-cloak='')
form(name="rejectionForm")
md-dialog-content
.md-dialog-content
h2.md-title Reject confirmation for
div(ng-bind-html="vm.parent.task.label")
div {{rejectionForm | json}}
textarea(placeholder="Please provide a reason for rejection", name="reason", style="width: 530px; height: 75px", ng-required="true")
div(ng-messages="rejectionForm.reason.$error")
div(ng-message="required") You need to give the reason
md-dialog-actions(layout="row")
span(flex)
md-button(ng-click="vm.parent.cancel()") CANCEL
md-button.md-primary.md-raised(ng-click="vm.parent.reject()", ng-disabled="rejectionForm.$invalid") REJECT
The issue is that when the form field instance called reason
is supposed to be created in rejectionForm
, the resulting JSON does not reflect this:
{
"$error": {},
"$name": "rejectionForm",
"$dirty": false,
"$pristine": true,
"$valid": true,
"$invalid": false,
"$submitted": false
This raises concerns about why the reason
field is missing and why the form is not being validated as expected.