form validation not working correctly in ui-router/ui-view using Bootstrap

前提是你 提交于 2019-12-13 05:14:39

问题


I have a form validation using bootstrap and It is working, but when I added it to my project that is running UI-router if breaks some of the CSS functionality for the function. So I think that it is being broken by the UI-Router. Basically it won't hind the error message until it is called. It just loads into a visible state. Is there someone that has run across this that could take a look at it.

I have two Plkr illistrating the issue. One working without UI-Router and On Not working With UI-Router.--> You will find the validated form under the Phone Tab.

Also I How do I set the min and max numbers correctly?

<div class="form-group" show-errors>
    <label class="control-label">Phone Number</label>
    <input type="number" min="10" max="10" class="form-control" 
        name="phonenumber" ng-model="phonenumber" 
        required placeholder="phone number with area code" />
    <p class="help-block" ng-if="userForm.phonenumber.$error.required">
        The Phone number is required
    </p>
    <p class="help-block" ng-if="userForm.phonenumber.$error.min">
        Oops! You don't have enough numbers. Format the phone number like 
        this "Ex: 4155551234"
    </p>
    <p class="help-block" ng-if="userForm.phonenumber.$error.max">
        Oops! You have too many numbers. Format the phone number like this 
        "Ex: 4155551234"
    </p>
 </div>

来源:https://stackoverflow.com/questions/26064906/form-validation-not-working-correctly-in-ui-router-ui-view-using-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!