html 스톱워치

5391 단어
/span>html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> title>
    <script src="dsadas/jquery-3.2.1.js">script>
    <script src="dsadas/angular1.4.6.min.js">script>
head>
<body ng-app="myApp" ng-controller="myController">
<span ng-bind="clock">span>
<button ng-bind="butn" ng-click="clocker()">button>
<script>
    var myApp=angular.module("myApp",[]);
    var controller=myApp.controller("myController",function ($scope) {
       $scope.clock=0;
       $scope.butn=" ";
       var timer;
       $scope.clocker=function () {
           if ($scope.butn == " ") {
               $scope.butn = " ";
               timer = setInterval(function () {
                   $scope.$apply($scope.clock--);
               }, 1000);
           }
           else{
               $scope.butn=" ";
               clearInterval(timer)
               }
       };
    });
script>
body>
html>

좋은 웹페이지 즐겨찾기