angularjs - Bootstrap Validator with angular -
i have problems bootstrap-validator plugin in angular:
this directive:
module.registerdirective('bootstrapuserform', function(){ return { restrict: 'ae', link: function(scope, form){ form.bootstrapvalidator({ feedbackicons : { valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : { title: { validators : { notempty : { message : 'bitte geben sie einen titel ein' } } }, firstname: { validators : { notempty : { message : 'bitte geben sie einen vornamen ein' } } } } }); } } });
and form:
<bootstrapuserform id="smart-form-register" class="smart-form" action="/api/test" bootstrapuserform> <fieldset> <div class="row"> <section> <label class="input"> <i class="icon-append fa fa-user"></i> <input type="text" name="username" placeholder="mustermannm" ng-model="userdata.username"> <b class="tooltip tooltip-bottom-right">bitte geben sie einen benutzernamen ein</b> </label> </section> <section> <label class="input"> <i class="icon-append fa fa-envelope-o"></i> <input type="email" name="email" placeholder="m.mustermann@gmail.com" ng-model="userdata.email"> <b class="tooltip tooltip-bottom-right">bitte geben sie eine emailadresse ein</b> </label> </section> </fieldset> <footer> <button type="button" class="btn btn-danger pull-left" data-ui-sref="app.maindata.users"> <i class="fa fa-arrow-left"></i> zurück </button> <button type="submit" class="btn btn-primary pull-right" type="submit"> <i class="fa fa-save"></i> erstellen </button> </footer> </bootstrapuserform>
the form snipped.
bootstrap validator dont validate data. added directive name html attribute, think there error in directive. i´am new angular , directives.
add novalidate in form tag , use bootstrap-user-form try..
<bootstrap-user-form novalidate id="smart-form-register" class="smart-form" action="/api/test" bootstrapuserform> <fieldset> <div class="row"> <section> <label class="input"> <i class="icon-append fa fa-user"></i> <input type="text" name="username" placeholder="mustermannm" ng-model="userdata.username"> <b class="tooltip tooltip-bottom-right">bitte geben sie einen benutzernamen ein</b> </label> </section> <section> <label class="input"> <i class="icon-append fa fa-envelope-o"></i> <input type="email" name="email" placeholder="m.mustermann@gmail.com" ng-model="userdata.email"> <b class="tooltip tooltip-bottom-right">bitte geben sie eine emailadresse ein</b> </label> </section> </fieldset> <footer> <button type="button" class="btn btn-danger pull-left" data-ui-sref="app.maindata.users"> <i class="fa fa-arrow-left"></i> zurück </button> <button type="submit" class="btn btn-primary pull-right" type="submit"> <i class="fa fa-save"></i> erstellen </button> </footer>
Comments
Post a Comment