参考博客: 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. Pig Flatten 解包操作,解元组

    Flatten Operator The FLATTEN operator looks like a UDF syntactically, but it is actually an operator ...

  2. 使用VS Code配合Remote Development插件连接远程服务器(Mac/Linux+Windows) | Using VS Code with Remote Development Connect to Remote Server (Mac/Linux+Windows)

    最新版VS Code(2019年6月)出了一系列新的插件,包括Remote Development,Remote SSH等,使得用户可以使用VS Code远程连接服务器写代码,方便了协同工作.具体配置 ...

  3. Sharepoint2013商务智能学习笔记之Performancepoint service 配置(九)

    1)配置Performance Service服务 第一步,新建performance service.先在管理中心,系统设置区域点击管理服务器上的服务,确认Performance Service服务 ...

  4. Spark 各个组件关系

    Term Meaning Application User program built on Spark. Consists of a driver program and executors on ...

  5. sql获取上月同期

    select CONVERT(varchar(10), CONVERT(varchar(8),dateadd(month,-1,getdate()),23)+CONVERT(varchar(10),d ...

  6. 一个web.Config或app.Config自定义段configSections的示例--转

    直接用配置文件app.Config或web.Config配置应用系统的运行参数,比自己做一个xml配置文件,简洁方便得多.这两个配置文件不仅有常见的connectionStrings和appSetti ...

  7. 业务、数据记录——ThreadPool.QueueUserWorkItem及Redis的实现

    业务描述 当用户执行完业务操作,或者数据操作后,讲业务记录/数据追踪插入到Redis中.ThreadPool.QueueUserWorkItem定时检查队列并将上述数据插入到数据库中持久化. 实现流程 ...

  8. [Xcode 实际操作]四、常用控件-(2)UIButton图片按钮的使用

    目录:[Swift]Xcode实际操作 本文将演示图片按钮的使用 在项目导航区,打开视图控制器的代码文件[ViewController.swift] import UIKit class ViewCo ...

  9. ALSA声音编程

    1. ALSA设备驱动将ALSA设备描述分为四层,从上到下为: default default:0 plughw:0,0 hw:0,0 不同的层次,对设备的控制权限不同,比如hardware para ...

  10. linux网络配置详解

    一:相关网络配置的文件 1.网卡名配置相关文件 网卡名命名规则文件: /etc/udev/rules.d/70-persistent-net.rules # PCI device 0x8086:0x1 ...