Explanation on a piece of code


I’ve just started AngularJS a day ago and have been questioning most of the lessons. Why does product.price and product.likes show up in circles in the console when printed using {{ product.price }} and {{ product.likes }} in index.html? Are the specifications declared using a stylesheet.css?

Also, can anyone explain this bit of code for me and what it does?

$scope.plusOne = function(index) {
$scope.products[index].likes += 1;


Very likely. Open the style sheet file and you should be able to find the selectors that target those two elements. Check the HTML for class or id.

$scope is the page environment to which all variables are scoped as attributes of that object. The function increases the product likes by 1.


Thanks for the help!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.