Nis*_*tty 4 angularjs angular-timer
我想显示倒计时器.我一直在参考以下页面 http://siddii.github.io/angular-timer/
但我得到以下错误.
错误:指令计时器的隔离范围定义无效:@?
谁能告诉我我错过了什么?
的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>
Run Code Online (Sandbox Code Playgroud)
app.js
var appModule=angular.module('app', ['timer']);
Run Code Online (Sandbox Code Playgroud)
JcD*_*n86 13
试试这个.它的工作原理是:
我加入moment.js和humanizeDuration.js库基于错误我得到.
希望能帮助到你
<!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>Run Code Online (Sandbox Code Playgroud)