사용자 정의 크기 맞추기 게임

5905 단어

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Titletitle>
    <script src="../angular.min.js">script>
    <script>
         var myapp=angular.module("myapp",[]);
         myapp.controller("myctrl",function ($scope) {
        $scope.check=function () {

            $scope.differ=Math.ceil(Math.random()*10);
            console.log($scope.differ);
            console.log($scope.guess);
            $scope.differ=$scope.guess-$scope.differ;
            $scope.number++;
        }
        $scope.reset=function () {
            $scope.guess="";
            $scope.differ=null;
            $scope.number=0;

        }
             $scope.reset();
         })
    script>
head>
<body ng-app="myapp" ng-controller="myctrl">
<p> 1--10 p>
<p> {{number}} p>
<input type="text" ng-model="guess">
<button ng-click="check()"> button>
<button ng-click="reset()"> button>
<p> {{guess}}, {{differ}}p>
<p ng-if="differ>0">p>
<p ng-if="differ<0">p>
<p ng-if="differ==0" style="color: red">p>


body>
html>

좋은 웹페이지 즐겨찾기