これは私の最初の投稿ですので、誰もが "Hello World"です。私はangularJSモジュールに初心者スタイルの問題があり、それがどこにあるのか気づくことができません。誰かが私のコードスニペットを見て、データを表示するのがなぜ正しく動作しないのかアドバイスをくれますか?AngularJS view-controller
ありがとうございました!
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
var one = angular.module('realSimpleCalc', []);
one.controller('calcContr', function ($scope) {
$scope.score = function() {
if ($scope.condition == '+') {
return ($scope.firstDigit + $scope.secondDigit);
}
else if ($scope.condition == "-") {
return (+$scope.firstDigit - +$scope.secondDigit);
}
else if ($scope.condition == '*') {
return $scope.firstDigit * $scope.secondDigit;
}
else if ($scope.condition == '/') {
return ($scope.firstDigit/$scope.secondDigit);
}
else if ($scope.condition == '%') {
return $scope.firstDigit % $scope.secondDigit;
}
};
});
</script>
<body>
<div ng-app = "realSimpleCalc" ng-controller = "calcContr">
<input type = "number" ng-model = "firstDigit" required/>
<select ng-model = "condition">
<option>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
<option>%</option>
</select>
<input type = "number" ng-model = "secondDigit"/>
<label>=</label>
<input type = "text" ng-bind = "score"/>
</div >
</body>
</html>