Here is their demo script. How do I require a field to be needed?
var confirm = $mdDialog.prompt() .title('What would you name your dog?') .textContent('Bowser is a common name.') .placeholder('Dog name') .ariaLabel('Dog name') .initialValue('Buddy') .targetEvent(ev) .ok('Okay!') .cancel('I\'ma cat person'); $mdDialog.show(confirm).then(function(result) { $scope.status = 'You decided to name your dog ' + result + '.'; }, function() { $scope.status = 'You didn\'t name your dog.'; });
Currently, you can enter an empty field and then confirm the request, as a result of which the dialog closes and the success function is called by the result value undefined
Ideally, I would like an error message to appear and the dialog will remain open when there is an empty field.
I'm sure I can achieve this through a special dialog, but I hoped there was a simple setup that I skip
source share