参考博客: 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的更多相关文章

  1. angular和datatables一起使用的时候,出现TypeError: Cannot Read Property "childNodes" Of Undefined In AngularJS

    在anguglar中注入'$timeout' 然后: $timeout(function{},0,false);

  2. 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 ...

  3. (转)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 ...

  4. [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() ...

  5. 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 ...

  6. 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 ...

  7. Null hypothesis TypeⅠerror Type Ⅱ error

    Null hypothesis usually express the phenomenon of no effect or no difference. TypeⅠerror is the inco ...

  8. [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 ...

  9. TP5报错variable type error: array

      variable type error: array 当你在tp5框架中写方法时返回一个数组时,tp5会报错:variable type error: array 这是因为tp5不支持返回数组. ...

随机推荐

  1. android studio在windows上设置git/ssh

    windows果然是与众不同的,凡事都要那么麻烦一点点(当然..是对程序员来说..) 一开始,我想用cygwin里的git,就省得我再多装一套软件,配置也可以统一,但事实证明不行 在android s ...

  2. keras安装windows版

    按照官网成功了.下面没有成功,貌似是 Anacode的问题 http://blog.csdn.net/hweiyi/article/details/70018317 http://blog.csdn. ...

  3. CodeForces 492D Vanya and Computer Game (思维题)

    D. Vanya and Computer Game time limit per test 2 seconds memory limit per test 256 megabytes input s ...

  4. c++中字符串的截取:

    c++中字符串的截取: string 类提供字符串处理函数,利用这些函数,程序员可以在字符串内查找字符,提取连续字符序列(称为子串),以及在字符串中删除和添加.我们将介绍一些主要函数. 1.函数fin ...

  5. hdu 5147 Sequence II (树状数组 求逆序数)

    题目链接 Sequence II Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  6. bootstrap常用部件下载

    http://shapebootstrap.net/item/1524915-adminlte-dashboard-and-control-panel/live-demo

  7. VS插件开发(生成实体类)

    写了N年的代码,回头过来看,其中有80%代码都是重复的代码,深入研究VS插件开发,应用到工作中,让自己减少基础的代码开发,增加开发效率 1.新增解决方案: Extensiblity->VSIX ...

  8. bzoj3720: Gty的妹子树(树分块)

    传送门 好珂怕…… 树分块是什么东西啊……感觉好暴力…… 直接贴一下好了->这里 //minamoto #include<iostream> #include<cstdio&g ...

  9. jmeter-提取器之正则表达式提取器

    在接口测试中,有很多的接口参数值是需要从上一个接口的返回值中获取的,这个时候就可以用正则表达式提取器啦 例如: 接口1  /user/login 返回{ "user_ticket" ...

  10. Docker Flie

    七.Docker File .dockeringore:打包忽略的文件列表,每行写一个文件的路径,可使用通配符 FROM指令:指定基础镜像 FROM <repository>[:<t ...