I need to make sure the name input matches the pattern. AngularJS cannot see name and set required error although they are reside in one div. It's not rational to start declatation from form bacause it has a lot of divs without names. How to make required field visible to Angular?
<form ng-app="" ng-controller="myCtrl" action="" name="productForm" class="form-horizontal" id="addproductForm" role="form" novalidate>
<div class="form-group" ng-class="{ 'has-error': productName.$invalid }">
<label for="product_name" class="col-sm-3 control-label">product name: </label>
<div class="col-sm-8">
<input id="product_name" name="productName" type="text" ng-model="testproductName" ng-pattern='/^[a-zA-Z0-9_.-]*$/' required/>
</div>
</div>
</form>