参考博客: 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. 8、非root权限下安装perl以及perl模块

    转载:http://www.cnblogs.com/nkwy2012/p/6418669.html 转载自http://www.zilhua.com 在本博客中,所有的软件安装都在服务器上,且无roo ...

  2. 内核启动流程2-C语言部分的最后一个函数init_post()

    最后分析最终调用用户空间init进程的函数init_post(). static noinline int init_post(void)这是一个非_init函数.强制让它为非内联函数,以防gcc让它 ...

  3. Entity Framework Code-First(11):Configure One-to-One

    Configure One-to-Zero-or-One Relationship: Here, we will configure One-to-Zero-or-One relationship b ...

  4. 泛型中new()约束的用法

    一..NET中支持的类型参数约束有以下几种 where T : struct              T必须是一个结构类型where T : class               T必须是一个类( ...

  5. Netty 线程模型与Reactor 模式

    前言 Netty 的线程模型是基于NIO的Selector 构建的,使用了异步驱动的Reactor 模式来构建的线程模型,可以很好的支持成百上千的 SocketChannel 连接.由于 READ/W ...

  6. DES的雪崩效应分析

    明文固定,密钥改变一个字节 假定明文为11111111(00000001 00000001 00000001 00000001 00000001 00000001 00000001 00000001) ...

  7. 前端编码规范 -- html篇

    文档类型 推荐使用 HTML5 的文档类型申明: <!DOCTYPE html> (建议使用 text/html 格式的 HTML.避免使用 XHTML.XHTML 以及它的属性,比如 a ...

  8. Mail.Ru Cup 2018 Round 2C(__gcd)

    #include<bits/stdc++.h>using namespace std;long long mx(long long l1,long long r1,long long l2 ...

  9. bzoj1010 玩具装箱

    玩具装箱 P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1...N的N件玩具, ...

  10. UIDevice的简易说明

    typedef NS_ENUM(NSInteger, UIDeviceOrientation) //设备方向 { UIDeviceOrientationUnknown, UIDeviceOrienta ...