I have implemented two functions to handle the timing of a process, one for starting and one for stopping. Here is the code snippet:
$scope.start = function(data) {
$scope.time = {
id: '',
mainId: data.id,
start: ''
}
$scope.Mydata = data;
function startTime() {
$http.post('/api/timestart', $scope.time).then(function(response) {
});
}
startTime();
}
$scope.stop = function(data) {
$scope.time = {
id: '',
mainId: data.id,
start: '',
stop: moment(new Date())
}
$scope.Mydata = data;
function stopTime() {
$http.post('/api/timestop', $scope.time).then(function(response) {
});
}
stopTime();
}
My goal is to pass the data from the start() function to the stop() function.
I am looking for a way to efficiently transfer data between functions within the same controller using AngularJS.