AngularJs Type error : Cannot read property 'childNodes' of undefined
参考博客: https://blog.csdn.net/u011127019/article/details/73087868
在AngularJs和JQuery插件共存咋项目中经常会遇到如下异常
Type error : Cannot read property 'childNodes' of undefined

解决方案1:
timeout(init, );
引用$timeout服务,异步执行JQuery的初始化代码
解决方案2:
angular.element(document).ready(function () {
//Angular breaks if this is done earlier than document ready.
setupSliderPlugin();
});
在angularjs初始化视图之后执行JQuery 的绑定
Example:
@*工具栏*@
<div id="toolBar">
<div class="btn-group">
<a class="btn green" ng-click="addBtnClick()"><i class="fa fa-plus">新建</i></a>
<a class="btn red"><i class="fa fa-trash">删除</i></a>
</div>
</div> <table id="datatable" class="table table-striped table-hover table-bordered"
data-search="true"
data-show-refresh="true"
data-show-toggle="true"
data-show-columns="true"
data-toolbar="#toolBar">
</table>
//绑定列表
var table = null;
$timeout(function () {
table = $('#datatable').bootstrapTable({
columns: [
{ field: 'checkbox', title: '主键', checkbox: true },
{ field: 'Name', title: '角色名称' },
{ field: 'SortValue', title: '排序列' },
{
field: 'IsSys', title: '角色分类', formatter(value, row, index) {
if (value)
return '内置角色';
return '自定义角色';
}
},
{
filed: 'RoleID', title: '操作', formatter(value, row, index) {
var btn = '';
btn += '<span class="btn btn-xs blue" title="编辑"><i class="fa fa-edit"></i></span>';
btn += '<span class="btn btn-xs purple" title="权限"><i class="fa fa-gears"></i></span>';
return btn;
}
}
],
url: '/admin/menu/getlist_role',
pagination: true,
sidePagination: 'server',
queryParams: function (params) {
return params;
}
});
}, 0);
AngularJs Type error : Cannot read property 'childNodes' of undefined的更多相关文章
- angular和datatables一起使用的时候,出现TypeError: Cannot Read Property "childNodes" Of Undefined In AngularJS
在anguglar中注入'$timeout' 然后: $timeout(function{},0,false);
- Description Resource Path Location Type Error executing aapt: Return code -1073741819 Client line 1
Logcat报错:Description Resource Path Location Type Error executing aapt: Return code -1073741 ...
- (转)Eclipse “cannot be resolved to a type” error
原:http://www.cnblogs.com/xuxm2007/archive/2011/10/20/2219104.html Eclipse “cannot be resolved to a t ...
- [TI DLP Buglist]data type error in illum_EnableIllumination function
I am debuging my code today, I find when my code is running, it's stop at illum_EnableIllumination() ...
- Nginx failing to load CSS and JS files (MIME type error)
Nginx failing to load CSS and JS files (MIME type error) Nginx加载静态文件失败的解决方法(MIME type错误) 上线新的页面,需要在n ...
- Vue使用Typescript开发编译时提示“ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'afterCompile' of undefined”的解决方法
使用Typescript开发Vue,一切准备就绪.但npm start 时,提示“ ERROR in ./src/main.tsModule build failed: TypeError: Cann ...
- Null hypothesis TypeⅠerror Type Ⅱ error
Null hypothesis usually express the phenomenon of no effect or no difference. TypeⅠerror is the inco ...
- [Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined、vuejs路由使用的问题Error in render function
1.[Vue warn]: Error in render: "TypeError: Cannot read property '0' of undefined 注意,只要出现Error i ...
- TP5报错variable type error: array
variable type error: array 当你在tp5框架中写方法时返回一个数组时,tp5会报错:variable type error: array 这是因为tp5不支持返回数组. ...
随机推荐
- crontab简易入门
前言 crontab是Unix和Linux用于设置周期性被执行的指令,是互联网很常用的技术,很多任务都会设置在crontab循环执行,如果不使用crontab,那么任务就是常驻程序,这对你的程序要求比 ...
- 在命令行上启动genymotion虚拟机
自从有了genymotion,多机联调就解放了,一台电脑运行两个genymotion虚拟机毫无压力,不过也看用的是哪种os image,之前我以为google自己的Nexus应该最适应,哪知道开起来比 ...
- p1516&poj1061&bzoj1477 青蛙的约会
传送门(洛谷) 题目 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面.它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止.可是它们出发之前忘记了一件很重要的事情 ...
- jquery提供的数据提交方式1
1,ajax提交,部分代码为easyui function editNode(id){ $.ajax({ dataType:'json', async:true, //默认的就是异步提交 type:' ...
- PS2018学习笔记(25-29节)
25-亮度与色阶看懂直方图-part1 # 本节知识点: 灰度模式 明暗对比 明度/对比度命令 直方图 色阶命令 调整图层 # 本节段落表: 了解亮度对比 灰度模式观察明暗 明度/对比度命令 认知对比 ...
- 解读人:谭亦凡,Macrophage phosphoproteome analysis reveals MINCLE-dependent and -independent mycobacterial cord factor signaling(巨噬细胞磷酸化蛋白组学分析揭示MINCLE依赖和非依赖的分支杆菌索状因子信号通路)(MCP换)
发表时间:2019年4月 IF:5.232 一. 概述: 分支杆菌索状因子TDM(trehalose-6,6’-dimycolate)能够与巨噬细胞C-型凝集素受体(CLR)MINCLE结合引起下游通 ...
- windows系统IIS7环境下如何部署MVC项目
首先打开IIS:第一步:添加MVC程序映射 打开其中的:处理程序映射,如下图: 点击界面右边操作中的:添加脚本映射,弹出下图: 请求路径:* 可执行文件:c:/Windows/Mi ...
- 通过ps给透明通道的图片添加灰度(适用于需要兼容IE7,效果很好)
原始的图片是这样的 第一步: 第二步: 第三步: 第四步: 更多(文字居中): 1: 2: 3: 4:
- ng2学习--pipe使用
We use our custom pipe the same way we use built-in pipes.(自定义Pipe和API里自带的Pipe使用方式一致) We must includ ...
- eclipse类自动生成注释
1.创建新类时自动生成注释 window->preference->java->code styple->code template 当你选择到这部的时候就会看 ...