【发布时间】:2018-05-31 18:01:38
【问题描述】:
我正在构建一个项目管理应用程序,我想跟踪用户工作的开始和停止时间。
所以我在 UI 中有两个按钮,开始和停止如果用户单击 开始 按钮,下面的函数将获取当前时间
$scope.start =function(){
$scope.begin = moment(new Date());
}
如果用户点击STOP按钮,下面这个函数会得到当前时间
$scope.stop =function(){
$scope.end = moment(new Date());
}
所以我想在这种类型的对象中获取两个数据 $scope.begin 和 $scope.end :
{
time:[
{ begin: 3:59:1 Dec/18/2017 ; end:5:59:1 Dec/18/2017 },
//if user click again start and stop i want another object dynamically
{ begin: 5:59:1 Dec/18/2017 ; end:6:59:1 Dec/18/2017 }
{ begin: 5:59:1 Dec/18/2017 ; end:6:59:1 Dec/18/2017 }
{ begin: 5:59:1 Dec/18/2017 ; end:6:59:1 Dec/18/2017 }
//dynamically want add this objects by user operations
]
}
如何做到这一点我正在使用 angularjs 和 nodejs
【问题讨论】:
标签: javascript arrays angularjs json node.js