I am a very beginner at HTML5, CSS and Angular. I tried to write a simple code to program a button that could change the value of a boolean, just to check how the connections are done. The code is the following:
<!DOCTYPE html>
<html>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
</script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click="myFunction">Click Me!</button>
<br>
<p>
{{myBool}}
</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.myBool = "true";
$scope.myFunction = function() {
if ($scope.myBool == true) {
$scope.myBool = false;
} else {
$scope.myBool = true;
}
};
});
</script>
</body>
</html>
But when I press the button, nothing happens. Can someone tell me why? Any help is welcome because, as you can see, I am quite lost.