Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Timer not working

I want to display a count down timer.I have been referring the following page http://siddii.github.io/angular-timer/

But i am getting the below error.

Error: Invalid isolate scope definition for directive timer: @?

Could anybody tell me what i am i missing out.

index.html

<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="angular-timer.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<timer end-time="1451628000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
</body>
</html>

app.js

var appModule=angular.module('app', ['timer']);
like image 843
Nisha shetty Avatar asked Dec 06 '22 21:12

Nisha shetty


1 Answers

Try this. It's working:

I added moment.js and humanizeDuration.js libraries based on errors I was getting.

Hope it helps

<!DOCTYPE html>
<html>

  <head>
   <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.1/angular.min.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js"></script>
   <script src="https://raw.githubusercontent.com/EvanHahn/HumanizeDuration.js/master/humanize-duration.js"></script>
   <script src="https://raw.githubusercontent.com/siddii/angular-timer/master/dist/angular-timer.js"></script>
  </head>

   <body ng-app="app">

    <div ng-controller="ctrl">
      <timer end-time="1451628000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
	</div>
	
	<script>
	   var app = angular.module('app',['timer']);
			
	   app.controller('ctrl', function($scope){});
	</script>
   </body>
</html>
like image 113
JcDenton86 Avatar answered Dec 21 '22 11:12

JcDenton86