я обновил код в HTML
<!doctype html>
<html lang="en">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular-messages.js"></script>
<script src="script.js"></script>
</head>
<body>
<div ng-app='ngMessagesExample'>
<!-- App goes here -->
<form name="test" novalidate ng-submit="test.$valid && submit()">
<div layout-gt-md="row">
<md-input-container class="md-block" flex-gt-xs>
<label>Number</label>
<input required ng-model="user.number" name="number" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/" >
<div ng-messages="test.number.$error">
</div>
<div ng-messages="test.$error" ng-show="test.number.$dirty"><div ng-message="required">number is required</div></div>
<span ng-show="test.number.$error.pattern">Please Enter Valid Input</span>
</md-input-container>
</div>
</form>
</div>
</body>
</html>