I have following code snippet(working) here, why can we still use this.review inside addReview
function. It seems wrong context for using this.review
because this
variable must be for addReview
function not for parent function. Correct me if I am wrong.
app.controller('ReviewCtrl',function() {
this.review= {};
this.addReview = function(product) {
product.reviews.push(this.review);
this.review={};
}
});