欢迎您访问我爱IT技术网,今天小编为你分享的javascript教程:【Angularjs编写KindEditor,UEidtor,jQuery指令】,下面是详细的讲解!
Angularjs编写KindEditor,UEidtor,jQuery指令
angular.module('AdminApp').directive('uiDatatable', ['uiLoad', '$compile', function (uiLoad, $compile) {
return function ($scope, $element, attrs) {
$scope.getChooseData=function () {
var listID="";
var chooseData=$element.find("input[name=IsChoose]:checkbox:checked");
if (chooseData.length > 0) {
for (var i=0; i < chooseData.length; i++) {
listID +=chooseData[i].value + ",";
}
}
return listID.substring(0, listID.length - 1);
}
$scope.refreshTable=function () {
$scope.dataTable.fnClearTable(0); //清空数据
$scope.dataTable.fnDraw(); //重新加载数据
}
uiLoad.load(['../Areas/AdminManage/Content/Vendor/jquery/datatables/jquery.dataTables.min.js',
'../Areas/AdminManage/Content/Vendor/jquery/datatables/dataTables.bootstrap.js',
'../Areas/AdminManage/Content/Vendor/jquery/datatables/dataTables.bootstrap.css']).then(function () {
var options={};
if ($scope.dtOptions) {
angular.extend(options, $scope.dtOptions);
}
options["processing"]=false;
options["info"]=false;
options["serverSide"]=true;
options["language"]={
"processing": '正在加载...',
"lengthMenu": "每页显示 _MENU_ 条记录数",
"zeroRecords": '<div style="text-align:center;font-size:12px">没有找到相关数据</div>',
"info": "当前显示第 _PAGE_ 页 共 _PAGES_ 页",
"infoEmpty": "空",
"infoFiltered": "搜索到 _MAX_ 条记录",
"search": "搜索",
"paginate": {
"first": "首页",
"previous": "上一页",
"next": "下一页",
"last": "末页"
}
}
options["fnRowCallback"]=function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$compile(nRow)($scope);
}
$scope.dataTable=$element.dataTable(options);
});
$element.find("thead th").each(function () {
$(this).on("click", "input:checkbox", function () {
var that=this;
$(this).closest('table').find('tr > td:first-child input:checkbox').each(function () {
this.checked=that.checked;
$(this).closest('tr').toggleClass('selected');
});
});
})
}
}]);
关于Angularjs编写KindEditor,UEidtor,jQuery指令的用户互动如下:
相关问题:为什么使用AngularJS 指令
答:使用过 AngularJS 的朋友应该最感兴趣的是它的指令。现今市场上的前端框架也只有AngularJS 拥有自定义指令的功能,并且AngularJS 是目前唯一提供Web应用可复用能力的框架。 目前有很多JavaScript. 产品提供插件给Web开发人员。例如, Bootstrap ... >>详细
相关问题:请教一个angularjs中在指令调用controller方法的问题
答:实在是不能对jquery的ajax方法和基于页面dom的各种取值、传值方法满意(虽然jquery已经解救过我一次了),刚好手上这个项目用jquery的方法写了一半,决定试试很久以前自学的angularJS,把现在项目中jquery得部分用angularJS重写一遍。 >>详细
相关问题:请教AngularJS 和 jQuery 混用的问题 社区 Ruby China
答:controller里面是不能用的 建议在指令里面用,这样更符合开发规范,不知道你说的具体问题是什么 >>详细
- 【firefox】firefox浏览器不支持innerText的解决
- 【Extjs】Extjs学习过程中新手容易碰到的低级错误
- 【clearInterval】js clearInterval()方法的定义
- 【ComboBox】ComboBox 和 DateField 在IE下消失的
- 【dom】javascript dom追加内容实现示例-追加内容
- 【has】基于jquery的has()方法以及与find()方法以
- 【extjs】Extjs入门之动态加载树代码-动态加载树
- 【checkbox】让checkbox不选中即将选中的checkbox
- 【angularjs_scope】AngularJS中监视Scope变量以
- 【Array】js中更短的 Array 类型转换-类型转换
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
