I have a scenario where i need to show a div when the timer total value is < 0 Here is the directive code: -
angular.module('iSourcingApp.tpModule')
-
.directive('stopWatch', function($state) {
-
return {
-
restrict: 'A',
-
replace: false,
-
scope: {
-
name: "=",
-
timeOfInterview: "=",
-
onSend: '&',
-
startInterview: '&',
-
viewPage: "="
-
},
-
controller: function($scope, $rootScope, $interval) {
-
debugger
-
$rootScope.showDiv = {};
-
$scope.getTimeRemaining = function(endtime) {
-
$scope.t[$scope.name].total = Date.parse(endtime) - Date.parse(new Date());
-
$scope.t[$scope.name].seconds = Math.floor(($scope.t[$scope.name].total / 1000) % 60);
-
$scope.t[$scope.name].minutes = Math.floor(($scope.t[$scope.name].total / 1000 / 60) % 60);
-
$scope.t[$scope.name].hours = Math.floor(($scope.t[$scope.name].total / (1000 * 60 * 60)) % 24);
-
$scope.t[$scope.name].days = Math.floor($scope.t[$scope.name].total / (1000 * 60 * 60 * 24));
-
}
-
$scope.initializeClock = function(endtime) {
-
debugger
-
$scope.t = {};
-
$scope.t[$scope.name] = {};
-
$scope.updateClock = function() {
-
debugger
-
$scope.getTimeRemaining(endtime);
-
$scope.t[$scope.name].hours = ('0' + $scope.t[$scope.name].hours).slice(-2);
-
$scope.t[$scope.name].minutes = ('0' + $scope.t[$scope.name].minutes).slice(-2);
-
$scope.t[$scope.name].seconds = ('0' + $scope.t[$scope.name].seconds).slice(-2);
-
if ($scope.t[$scope.name].total == 0) {
-
console.log($scope.t[$scope.name].total);
-
$interval.cancel($scope.timeinterval);
-
$rootScope.showDiv[$scope.name] = true;
-
alert("Start interview for " + $scope.name);
-
} else {
-
if ($scope.t[$scope.name].total < 0) {
-
$interval.cancel($scope.timeinterval);
-
$rootScope.showDiv[$scope.name] = true;
-
}
-
}
-
}
-
$scope.updateClock();
-
$scope.timeinterval = $interval($scope.updateClock, 1000);
-
}
-
$scope.initializeClock($scope.timeOfInterview);
-
},
-
templateUrl: function() {
-
var tpl = $state.current.name;
-
return './tpModule/views/' + tpl + '.html';
-
}
-
};
-
});
-
Here if $scope.t[$scope.name].total < 0then i am setting showDiv to true and when it is true i m showing a div -
<div ng-show="showDiv[candidateInfo.name]" class="col-xs-offset-4 showDiv">
-
<p class="timer-text">The interview for {{candidateInfo.name}} has crossed scheduled time</p>
-
<div class="row showDiv" >
-
<a class="timer-text col-xs-3" style="cursor:pointer" ng-click="fnReschedule(candidateInfo.name, candidateInfo.recruiter)"><i >reschedule</i></a>
-
<a class="timer-text col-xs-3" style="cursor:pointer" ng-click="fnStartInterview(candidateInfo.name,candidateInfo.presentRound,candidateInfo.askedQuestions,candidateInfo._id,candidateInfo.dateOfInterview)"><i class="text-center">start interview</i></a>
-
</div>
-
</div>
-
So,what is happening here is initially some template is shown and after a sec or so the div is shown but i need not show the template initially if the timer is < 0
and the timer is different for different candidates
Any help would be appreciated.
0 1256 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Trint Smith |
last post by:
I need to display a timer ticking down.
Example:
11h:52m:39s to 00h:00m:00s
How can I do this?
Thanks,
Trint
.Net programmer
trintsmith@hotmail.com
|
by: HeroinNO.4 |
last post by:
Copy the code below and save in a .htm file, for example : 1.htm, then
run it in browser, you'll see a cool count down timer ! If it doesn't
work, you may open http://www.fillweb.com in IE and...
|
by: HeroinNO.4 |
last post by:
Hello guys, sorry for my last version has a little "feature"(MS always
call his bug "feature"), and now I fixed it and show the source to you
all ! Just as the last version, copy the code below and...
|
by: HeroinNO.4 |
last post by:
Hello guys, now the source code updated to November 06, 2006 00:00
GMT,and now I fixed it and show the source to you all ! Just as the
last version, copy the code below and save in a .htm file, fox...
|
by: HeroinNO.4 |
last post by:
You can open http://www.fillweb.com in IE and View->Source to see the
latest version full featured count down timer source code, or you may
also copy the code below and save in a "*.htm" file, for...
|
by: HeroinNO.4 |
last post by:
Hello everyone! Now the latest version of free count down timer source
code is available in http://www.fillweb.com/countdown.htm, you can open
it in IE and View->Source to see the latest version...
|
by: HeroinNO.4 |
last post by:
Hello guys, free count down timer source code has updated to 06/11/27,
you can copy the code below and save in a ".htm" file and run it in a
browser support javascript 1.1 or later, or you can open...
|
by: KMEscherich |
last post by:
Am using Access '97
This is going on a form.
Hi there, would like to know if there is a way to count down the days from when a user enters a date in a specific date field. If so, can someone...
|
by: missshaikh |
last post by:
Hi all,
i need the count down timer when button click the timer start and count down work on ASP.net
:(
i have one timer which is on JavaScript that run page onload . but i need the Button...
|
by: pratk |
last post by:
how to postback gridview when timer counts 0.radio buttons inside gv should be disabled when timer counts......any help would save my life......
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |