0
我是AngularJS的新手。我正在使用引导验证器来验证我的项目中的表单。这是工作的罚款,直到我下面的代码添加到我的控制器进行验证的JavaScript文件:无法在AngularJS中读取未定义错误的属性'childNodes'
$(document).ready(function() {
$('#searchProducts').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
keyword: {
message: 'The productname is not valid',
validators: {
notEmpty: {
message: 'The productname is required and cannot be empty'
},
stringLength: {
min: 6,
message: 'The productname must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_]+$/,
message: 'The productname can only consist of alphabetical, number and underscore'
}
}
},
}
});
});
我已经包含了以下在我的母版页的JavaScript文件的建议here
<script src="~/scripts/angular.js"></script>
<script src="~/scripts/angular-route.js"></script>
<script src="~/scripts/angular-route.min.js"></script>
<script src="~/scripts/jquery-2.1.1.min.js"></script>
<script src="~/scripts/angular-ui/ui-bootstrap.min.js"></script>
<script src="~/scripts/angular-ui/ui-bootstrap-tpls.js"></script>
<script src="~/scripts/angular-ui/ui-bootstrap-tpls.min.js"></script>
<script src="~/scripts/angular-local-storage.min.js"></script>
<script src="~/bootstrapvalidator/dist/js/bootstrapValidator.js"></script>
它给了我错误“无法读取属性'childNodes'未定义”在我的代码在主页面上:
<div class="container-fluid" style="margin: 0 20px;">
<div class="row">
<div data-ng-view="" class="main"></div>
</div>
</div>
我在做什么错? 谢谢。
使用jQuery /引导验证的单行小例子是出了什么问题... – Endless 2014-09-25 18:38:14
的http:// scotch.io/tutorials/javascript/angularjs-form-validation – DeadCalimero 2014-09-25 18:40:56
是的,但我看到它在[bootstrapvalidator](http://bootstrapvalidator.com/)中工作。我不能在我的项目中使用它吗? – mpatel 2014-09-25 18:41:40