I have the below text field where I'm using the ng-pattern for validation and displaying the message using ng-message. The validation works fine with the both the regex (/^\d+$/ or /^[0-9]+$/), but for some reason the regex (/^\d+$/) is returning false even for numeric inputs while using along with the template caching. I couldn't figure out the issue between these two approach. Please find the below templateCaching output. Any help is appreciated.
input type="text" ng-model="appId" name="appId" class="new-app" ng-pattern="/^\d+$/" placeholder="Enter an Application ID" required
Message :
div ng-message="pattern" class="error-messages"
Not Working with templateCaching:
input type="text" ng-model="appId" name="appId" class="new-app" ng-pattern="/^\d+$/" placeholder="Enter an Application ID" required
Working with both templateCaching and as a separate view file:
input type="text" ng-model="appId" name="appId" class="new-app" ng-pattern="/^[0-9]+$/" placeholder="Enter an Application ID" required
$templateCache.put('/views/layouts/test.html', '<input type="text" ng-model="appId" name="appId" class="new-app" ng-pattern="/^[0-9]+$/" placeholder="Enter an Application ID" required> <input type="text" ng-model="appId" name="appId" class="new-app" ng-pattern="/^\d+$/" placeholder="Enter an Application ID" required>');