Workflow 1st question


#1

How to declare scope property as a object
{
name: 'The Book of Trees',
price: 19
}


#2

same here problem please get me solution


#3
$scope.product = { 
      name: 'The Book of Trees',
    price: 19
  }

#4

app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My First Angular Program';
$scope.promo = 'Let me learn';
$scope.product = {
name: 'The Book of Trees',
price: 19
}
}]);

not working for me!!!!
please guide thanks!!!!


#5

app.controller('MainController',
['$scope', function($scope) {
$scope.title = 'My First Angular Program';
$scope.promo = 'Let me learn';
$scope.product = {
name: 'The Book of Trees',
price: 19
}
}]);

This works for me just syntax error.


#6

In fact the problem comes from } : the one which has to close the $scope.porduct is the one written near the closing }]); => we don't need to write it again when we set $scope.product.

Or else it is two of it, and : "There is only enough place for one weird parenthesis in this statement, die ! "( #guns in pockets, sand and dust whispering under the western sun )

:smile:


#7

Hey there! :smiley: For me is working just fine! :smile:

  1. Just copy and paste this code below, in the MainController.
    " app.controller('MainController',['$scope',function($scope){
    $scope.title='Top SSSellers in Books';
    $scope.promo ='Unde vine asta?';
    $scope.product =
    {
    name: 'The Book of Trees',
    price: 19
    }
    }]); "

  2. And after this, in view = index.html file, put this code in the < / p> tags.:
    < p class="title">{{product.name}}< /p >
    < p class="price">{{product.price}}< /p >

    "name" and "price" are the proprietys of the object "product". But you must put the full "p" tags -no spaces between the "<" and the "p" - i can't because is changing the tags, like you see below :
    "

    {{product.name}}

    "

#8

Wow, this helped a ton, thanks!!!


#9

Guys, it's case sensitive. so make sure to write the sentence exactly as it is.


#10

Yes guyz write a exact sentence which they want...