Solution: In memory counter
- ng-init
- ng-click
<script src="angular.min.js"></script>
<div ng-app>
<button ng-init="counter = 0" ng-click="counter = counter + 1">Increment</button>
{{counter}}
</div>
counter += 1 would not work
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
<script src="angular.min.js"></script>
<div ng-app>
<button ng-init="counter = 0" ng-click="counter = counter + 1">Increment</button>
{{counter}}
</div>
counter += 1 would not work