angularjs 整合bootstrap 时间控件
一、引入js
<link href="${basePath}/static/plugin/bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script type="text/javascript" src="${basePath}/static/plugin/bootstrap/js/bootstrap-datetimepicker.min.js" ></script>
<script type="text/javascript" src="${basePath}/static/plugin/bootstrap/js/bootstrap-datetimepicker.fr.js" ></script>
<script type="text/javascript" src="${basePath}/static/plugin/bootstrap/js/bootstrap-datetimepicker.zh-CN.js" ></script>
<script src="${basePath}/static/plugin/angular/js/angular.min.js"></script>
二、引入HTML
<input size="16" type="text" readonly class="form_datetime" style="width:120px" format-date ng-time ng-model="finishedDtm">
三、创建angularjs指令
formatDate指令做格式转换
ng-time 初始化bootstrap时间控件
注:有时候格式有问题 修改Date的toJSON方法获取本地时间字符串 Date.prototype.toJSON = function () { return this.toLocaleString(); }
bamboo.angularApp = angular.module('task', [])
.directive('formatDate', function(){
return {
require: 'ngModel',
link: function(scope, elem, attr, ngModelCtrl) {
ngModelCtrl.$formatters.push(function(modelValue){
if(modelValue) {
return modelValue;
}
});
ngModelCtrl.$parsers.push(function(value){
if(value) {
return new Date(value);
}
});
}
};
}).directive('ngTime', function() {
return {
restrict : 'A',
require : '?ngModel',
link : function($scope, $element, $attrs, $ngModel) {
if (!$ngModel) {
return;
}
$element.datetimepicker({
language: 'zh-CN',
weekStart: 1,
todayBtn: 1,
autoclose: true,
todayHighlight: true,
startView: 2,
format: 'yyyy-mm-dd hh:ii',
});
},
};
});
注:整合easyui时自定义操作列的ng-click事件绑定不生效可以使用 $compile($("#gridTable").parent())($scope); 进行重新渲染
{field:'openDetails',title:'展开详情',align:'center',resizable:true,width:'80',
formatter:function(value,row,index){
return '<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#hours_details" ng-click="hoursDetails(\''+row.lId+'\')">工时详情</button>';
}
}
angularjs使用了其他前端组件有时候渲染有问题需要使用$timeout进行渲染
function AddHoursController($rootScope,$scope,$timeout,$http){
$scope.initAddHours = function(){
//清理表单数据
$scope.paramList = [];
var lId = $("#add_hours [ng-model='laborDetail.lId']").val();
var laborDetail = {
"lId":lId
}
//获取所有项目模块
$.get(contextPath + "/labor/myLabor/hourTask/list.action",laborDetail,function (resp) {
var respData = resp.result;
for (var i = 0; i < respData.length; i++) {
respData[i].isNotEditable = true;
}
$timeout(function() {
//生成历史工时数据
$scope.laborDetails = respData;
});
});
}
};
angularjs 整合bootstrap 时间控件的更多相关文章
- Bootstrap 时间控件datetimepicker与timepicker
一.datetimepicker 首先,我们看看点击选择时间的时候的展示页面吧 年 月 ...
- bootstrap 时间控件
近期使用了bootstrap的UI感觉确实非常美丽,非常值得学习和使用. 以下先简单了解下bootstrap的时间控件. 这个时间控件使用起来还是很的简单.仅仅须要引入主要的css和js就能够了 须要 ...
- bootstrap 时间控件带(时分秒)选择器
1.控件下载地址:http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm,参数设置说明也在这个链接下面: 2.具体参数说明(复制原链接) ...
- bootstrap 时间控件带(时分秒)选择器(需要修改才能显示,请按照参数说明后面的步骤进行修改)
1.控件下载地址:http://www.bootcss.com/p/bootstrap-datetimepicker/index.htm,参数设置说明也在这个链接下面: 2.具体参数说明(复制原链接) ...
- Bootstrap时间控件常用配置项
1.给下面4个文本框初始化 $(function(){ $("#orderStartTime,#orderEndTime,#preSaleStartTime,#preSaleEndTim ...
- Bootstrap中时间(时间控件)的设计
运用bootstrap的时间控件,生成时间选择器. 1.截图:有以下这些样式 10年视图 年视图 月视图 日视图 小时视图 2.视图设计: ...
- BootStrap母版页布局.子页面布局.BootstrapTable.模态框.警告框.html导出tabl生成Excel.HTML生成柱图.饼图.时间控件中文版
如上就是很多后台管理系统的母版页布局. 左边一列模板.上面一列系统标识. 空白处充填子页面 以ASP.NET MVC为基础 引入bootstrap.js.bootstrap.css body: < ...
- bootstrap的时间控件使用(双日历)
这段时间看了下bootstrap的时间控件,发现使用起来还是很简单的,趁着有时间的时候整理了一下,方便自己以后忘记的时候查阅... 废话不多说先上效果图 接下来是代码实现 第一步当然是导入css.js ...
- bootstrap日期控件在火狐下的模态框中选择时间下拉菜单无效的解决办法
今天收到程序组提交的一个兼容BUG,在火狐中使用模态框加载日期控件时选择时间下拉菜单没有效果(不能点击),而在谷歌中却是好的, 排错思路:1,在当前页面主层放置一个时间控件,测试通过 2,在ajax加 ...
随机推荐
- Android ArrayAdapter,BaseAdapter,SimpleAdapter适配器绑定数据方法
/** * 2017-07-31.Book 类 */ public class Book { public String getName() { return name; } public void ...
- I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 问题
临时解决版本进入python后只需下面命令 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
- Mongodb系列文章
http://blog.csdn.net/congcong68 学习MongoDB 六: MongoDB查询(游标操作.游标信息)(三) Mongodb官方C#驱动示例 MongoDB Driver ...
- c#自定义控件做漂亮的列表
效果图如下: 完整项目代码下载: 点击下载
- 安装串口设备驱动时遇到 Windows 无法验证此设备所需的驱动程序的数字签名。最近的硬件或软件更改安装的文件可能未正确签名或已损坏,或者可能是来自未知来源的恶意软件. 问题该如何处理?
win7 系统直接在 cmd 命令行中输入以下语句,重启电脑后重新安装驱动即可. BCDEDIT -SET LOADOPTIONS DISABLE_INTEGRITY_CHECKS BCDEDIT - ...
- git 删除所有提交下的某个文件
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch upload/*' --prune-empty - ...
- https通讯原理
https通讯原理 HTTPS在传输数据之前需要客户端(浏览器)与服务端(网站)之间进行一次握手,在握手过程中将确立双方加密传输数据的密码信息.TLS/SSL协议不仅仅是一套加密传输的协议,更是一件经 ...
- 【云安全与同态加密_调研分析(3)】国内云安全组织及标准——By Me
◆3. 国内云安全组织及标准◆ ◆云安全标准机构(主要的)◆ ◆标准机构介绍◆ ◆相关标准制定◆ ◆建立的相关模型参考◆ ◆备注(其他参考信息)◆ ★中国通信标准化协会(CCSA) ●组织简介:200 ...
- Linux:Centos7升级内核(转)
更新前,内核版本为: uname -r 3.10.0-327.10.1.el7.x86_64 升级的方法: 1.导入key rpm --import https://www.elrepo.org/RP ...
- struts2.3+spring3.2+hibernate4.2例子
有些教程比较老,可是版本更新不等人,基于马士兵老师小例子,自己重新引用了新的包,调试确实有点烦人,但是通过英文文档和google解决问题.官网的更新超快,struts2.3+spring3.2+hib ...