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={};
}
});
$scopeinstead at least you are guaranteed on its state at all time.this. It looks trivial thatthisused in parent function andthisused in child function should be different.