Great! Each time you click on the number of likes, the number goes up. How does it work?
ng-click is a directive. When
<p class="likes"> is clicked,
ng-click tells AngularJS to run the
plusOne() function in the controller.
plusOne() function gets the index of the product that was clicked, and then adds one to that product's
Notice that the
plusOne() doesn't interact with the view at all; it just updates the controller. Any change made to the controller shows up in the view.