参考博客: 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. hadoop自动安装脚本

    还不能实现完全自动安装,只能算半自动的. 进行交互主要障碍有两点: 1. ssh-keygen的时候需要点击回车. 2. passwd 需要设置密码  如果谁能解决以上两点,欢迎email给我. 另外 ...

  2. Entity Framework Code-First(9.1):DataAnnotations - Key Attribute

    DataAnnotations - Key Attribute: Key attribute can be applied to properties of a class. Default Code ...

  3. e.key && e.which && e.keyCode

    官方推荐用e.key来描述状态码,其他两种属性可能会在未来被废弃. 且key,keyCode和which 为只读属性   但是会有浏览器兼容性的问题,可以采用如下代码:   let key = ''; ...

  4. [Win10] 安装虚拟光驱 用于加载ISO等镜像文件

    百度上找到UltraISO安装 一般来说安装到这就基本会显示一个 若经过上述步骤仍没出现虚拟光驱,则尝试进行加载ISO镜像文件到虚拟光驱然后再看看 这样基本就大功告成了~

  5. SCUT - 223 - Maya - 构造

    https://scut.online/p/223 给定两个数N,M,构造M个在[0,80000]以内的互不相同的数使之异或和为N. 首先特判一下M<=2的两个简单情况,还有坑爹的-1! 然后想 ...

  6. Codeforces Round #527 (Div. 3)C(多重集,STRING)

    #include<bits/stdc++.h>using namespace std;const int maxn=1e6+7;pair<string,int>p[maxn]; ...

  7. Cogs 2856. [洛谷U14475]部落冲突

    2856. [洛谷U14475]部落冲突 ★★★   输入文件:lct.in   输出文件:lct.out   简单对比时间限制:1 s   内存限制:256 MB [题目描述] 在一个叫做Travi ...

  8. 如何使用JDBC Request跨数据库查询后引用查询的结果作为下一个JDBC Request的入参

    [前言] 今天来给大家介绍下如何使用JDBC Request跨数据库查询后引用查询的结果作为下一个JDBC Request的入参! 因为我现在所测的系统模块中部分表在不同的数据库中,所以在用JDBC ...

  9. 安居客scrapy房产信息爬取到数据可视化(下)-可视化代码

    接上篇:安居客scrapy房产信息爬取到数据可视化(下)-可视化代码,可视化的实现~ 先看看保存的数据吧~ 本人之前都是习惯把爬到的数据保存到本地json文件, 这次保存到数据库后发现使用mongod ...

  10. 通过ps给透明通道的图片添加灰度(适用于需要兼容IE7,效果很好)

    原始的图片是这样的 第一步: 第二步: 第三步: 第四步: 更多(文字居中): 1: 2: 3: 4: