(<-) Add numbers ng-init
Solution: In memory counter (->)
Web development: Exercise: In memory counter
-
Create an application that has a button called 'Increment' and shows a number.
Every time the button is clicked the number increases by 1.
Implement it in a single HTML file without a 'script' tag.
-
Add another button called 'Decrement'.
When the user clicks that button the counter is decremented.
Still have this in a single HTML file without a 'script' tag.
-
Change the application now moving everything to a controller.
Both the initialization and the code of increment and decrement.
Disallow negative numbers: If the user clicks on 'decrement' while the counter
is at 0, display a message in a 'div' element that this operation is not allowed.