If you delete the initial text that is in the input element in the example below, then it will not show an error until you blur the element.
I want to have the input element underline turn red and the error show immediately when you delete the last character in the input.
Any ideas somebody?
var app = angular.module('myApp', ['ngMaterial', 'ngMessages']);
app.controller('DemoCtrl', function() {
this.name = 'test text';
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Angular JS</title>
<link
rel="stylesheet"
href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.6/angular-material.min.css">
</head>
<body ng-app="myApp">
<div ng-controller="DemoCtrl as demo">
<form name="testForm">
<md-input-container>
<input
name="testInput"
ng-model="demo.name"
required
aria-label="test input"
type="text">
<ng-messages
for="testForm.testInput.$error"
role="alert">
<ng-message when="required">
<span>
required
</span>
</ng-message>
</ng-messages>
</md-input-container>
</form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.6/angular-material.min.js"></script>
</body>
</html>