AngularJs Type error : Cannot read property 'childNodes' of undefined
来源:互联网 发布:35互联域名证书生成 编辑:程序博客网 时间:2024/06/07 11:42
一、在AngularJs和JQuery插件共存咋项目中经常会遇到如下异常
Type error : Cannot read property 'childNodes' of undefined
解决方案1:
$timeout(init, 0);
引用$timeout服务,异步执行JQuery的初始化代码
解决方案2:
angular.element(document).ready(function () { //Angular breaks if this is done earlier than document ready. setupSliderPlugin();});在angularjs初始化视图之后执行JQuery 的绑定
二、在使用Bootstrap-table绑定工具栏是就会遇到如上问题
@*工具栏*@<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 ng-bind-html指令整理
angularjs unsafe ng-href using javascript: void(0);
AngularJs $http 请求服务整理
阅读全文
0 0
- AngularJs Type error : Cannot read property 'childNodes' of undefined
- Angularjs报错:TypeError: Cannot read property 'slice' of undefined
- Ionic WebStrom Error: Cannot read property 'replace' of undefined
- "TypeError: Cannot read property 'undefined' of undefined"
- Uncaught TypeError: Cannot read property 'childNodes' of null
- Cannot read property 'autoCreated' of undefined
- TypeError: Cannot read property 'parentNode' of undefined
- Cannot read property 'nodeType' of undefined
- Cannot read property 'xxx' of undefined
- TypeError: Cannot read property 'left' of undefined
- Vue2-Cannot read property 'component' of undefined
- [Jquery]Cannot read property 'msie' of undefined
- Cannot read property ‘msie’ of undefined
- Cannot read property ‘msie’ of undefined
- Cannot read property 'rownumbers' of undefined
- TypeError: Cannot read property 'newLine' of undefined
- TypeError: Cannot read property 'password' of undefined
- TypeError: Cannot read property 'query' of undefined
- usb mtp激活流程
- FB_VISUAL_XXXXX-------色彩模式宏
- 前端怎么提高自身
- excel清单数据导入到开票软件中进行开票
- 如何升级到iOS11(ARKit)
- AngularJs Type error : Cannot read property 'childNodes' of undefined
- Java WebService 简单实例
- Android viewpager + fragment 的懒加载 只加载一次
- FFMPEG学习【libavfilter】(二)
- jQuery Ajax Support: Basics
- linux下umount强行卸载设备
- 商品处理
- Docker学习笔记(3)-- 如何使用Dockerfile构建镜像
- 数值的整数次方(java版)