hello in the controller, attach another property to $scope named product. Set it equal to an object with the following properties: how do you do this?. I would really appreciate some help thank you.
Hi, I had the same problem but I found the solution:
$scope.plusOne =
function(index) {
$scope.products[index].likes += 1;
};
It helps to link to where you are in the course.
@lubi123 That code doesn’t relate to his issue. I believe he’s on step 1 here.
This step isn’t that different from step 2 in the previous exercise (2. Hello AngularJS II). Instead of setting a property to a string, you’re setting it to the given object. Let me know if this helps!
Hey man,
so I’ve typed this…
app.controller('MainController', ['$scope', function($scope) {
$scope.title = 'Jimmy';
$scope.promo = ' Ryan';
$scope.product = {
name: 'The book of Trees',
price: 19
}
}]);
Where am I going wrong?
I thinks it’s fine, just rerun the code
For anyone having this problem, don’t forget that the product name is case-sensitive :
app.controller('MainController', ['$scope', function($scope) {
$scope.title = 'Jimmy';
$scope.promo = ' Ryan';
$scope.product = {
name: 'The Book of Trees',
price: 19
}
}]);
you just give a semicolon after the end braces following price property.
eg:-
app.controller(‘MainController’, [’$scope’, function($scope) {
$scope.title = ‘Jimmy’;
$scope.promo = ’ Ryan’;
$scope.product = {
name: ‘The Book of Trees’,
price: 19
};
}]);
you r ryt u have to use it in index with {{product.name}}