I want to validate IP Address.
My html page code is given below
<md-content class="md-padding" ng-controller="AddNewHostController as vm">
<form name="hostForm" ng-submit="vm.AddNewHost(hostForm.$valid)" novalidate>
<md-content md-theme="dark" class="md-padding" layout="row" layout-sm="column">
<md-input-container>
<input ng-model="vm.host.hostname" required placeholder="Hostame">
</md-input-container>
<md-input-container>
<input ng-model="vm.host.ipaddress" required placeholder="IP Address" ng-pattern="/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/">
</md-input-container>
<div ng-show="hostForm.$submitted || vm.host.ipaddress.$touched">
<span ng-show="vm.host.ipaddress.$error.pattern">Invalid input</span>
</div>
<md-input-container>
<input ng-model="vm.host.alias" required placeholder="Alias">
</md-input-container>
</md-content>
<md-content class="md-padding">
<button class="md-button md-ink-ripple" style="background-color:#7ec9c2; height: 12px; margin-left: 0px;">Add New Host</button>
</md-content>
</form>
</md-content>
But my ng-pattern
not working. On button click I did not get Invalid input error message.