seUser seUser - 1 year ago 189
Javascript Question

Angular ng-pattern for date not working on IE9

I am trying to use below date (mm/dd/yyyy) validation pattern using ng-pattern in view.


As soon as I start typing the date the validation error appears and stays even after having valid date such as 10/15/1988

I tried passing it through controller using var (as shown below) but behaves the same:

In Controller:

$scope.myPattern = "/^(\d{4})-(\d{2})-(\d{2})$/";

In View:


Note: This both approach not working only in IE9

Answer Source

How about:


This will work with both dd/mm/yyyy and yyyy-mm-dd

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download