Home Angular ng-message always shows
Reply: 0

Angular ng-message always shows

Dmitry
1#
Dmitry Published in 2017-11-07 21:40:45Z

What reason? Why ng-message always show? angularjs/1.2.7/angular.js included.There are no errors in the console.

        <body>
            <form name="myForm">
                <label>
                    Enter your name:
                    <input type="text"
                           name="myName"
                           ng-model="name"
                           ng-minlength="5"
                           ng-maxlength="20"
                           required />
                </label>
            <div ng-messages="myForm.myName.$error" style="color:maroon" role="alert">
                <div ng-message="required">You did not enter a field</div>
                <div ng-message="minlength">Your field is too short</div>
                <div ng-message="maxlength">Your field is too long</div>
            </div>
        </form>

        <script>
            (function () {
                      myForm.myName.$error = {
            }})
        </script>
        </body>

        </html>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.457119 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO