无法读取属性';子节点';AngularJS中未定义错误的定义
我对AngularJS是新手。我正在使用引导验证程序验证项目中的表单。在我将以下代码添加到我的控制器javascript文件进行验证之前,它工作正常:无法读取属性';子节点';AngularJS中未定义错误的定义,angularjs,twitter-bootstrap,validation,Angularjs,Twitter Bootstrap,Validation,我对AngularJS是新手。我正在使用引导验证程序验证项目中的表单。在我将以下代码添加到我的控制器javascript文件进行验证之前,它工作正常: $(document).ready(function () { $('#searchProducts').bootstrapValidator({ message: 'This value is not valid', feedbackIcons: {
$(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文件
它给我的错误是“无法读取未定义的属性'childNodes'”在主控视图页上的此代码:
<div class="container-fluid" style="margin: 0 20px;">
<div class="row">
<div data-ng-view="" class="main"></div>
</div>
</div>
我做错了什么?
谢谢。这里是一个小例子,说明了角度验证在没有一行javascript代码的情况下是如何工作的
搜索:
产品名称无效
产品名称必须大于6
产品名称的长度必须少于30个字符
产品名称是必需的,不能为空
使用jQuery/bootstrap验证是错误的……是的,但我看到它在应用程序中工作。我不能在我的项目中使用它吗?用一些奇怪的黑客你可能会把它从。。。但是angular有更好的表单验证in@Endless,DeadCalimero:谢谢你的帮助。我很感激。。
<div class="container-fluid" style="margin: 0 20px;">
<div class="row">
<div data-ng-view="" class="main"></div>
</div>
</div>