时间转化+angualr模态框

目录

经常能遇到需要对时间进行操作的需求,

1.根据开始时间 算出结束时间

        Date starTime=new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(starTime); 
        calendar.add(Calendar.MONTH, 1); 
        return calendar.getTime();

2.angular中使用模态框

A.html 中有一个按钮,点击之后 弹出一个框B页面,同时把A页面的数据带到 B页面

首先是A页面的 按钮

<button  ng-click="usingLastCostCenter()">
                         沿用上月目标 </button>

对应的js代码

app.controller("ACtr", function($scope,$modal  ) {
    $scope.copyotherEmpGoal = function(){ 
    //需要带到模态框的数据id
            var paramdata=$scope.param.objectiveId;
            var modalInstance = $modal.open({
                templateUrl: 'template/copyEmpGoalTarget_modal.html',
                controller: 'copyEmpGoalTarget_modal_ctrl',
                resolve: {
                    data: function () {
                        return paramdata;
                    }
                }
            });
    }

})

接着你就在A页面最下面 写


<script type="text/ng-template" id="template/copyEmpGoalTarget_modal.html">
    <div class="modal-header" >
        <h4 class="modal-title">选择人员</h4>
    </div>
    <div class="modal-body" style="max-height: 500px; overflow: scroll">
        <div  >
             B页面内容
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-default" ng-click="cancel()">取消</button>
        <button class="btn btn-success" ng-click="submitEmp()">提交</button>
    </div>
</script>

对应的js代码


app.controller("copyEmpGoalTarget_modal_ctrl", function($scope,                                      call_api,                                         $modalInstance,data) {
      data 参数就是 传输过来的数据 id
    $scope.submitEmp = function () {
        $modalInstance.close({});
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值