I am assigning a variable (ex. var
choice=“book1”) and then using it to find items in an array called listofbooks…so in my html I have {{listofbooks.choice[0].title}} or {{listofbooks.choice[0].price}} but it is not coming up with
anything…
if you want to access the variable in the template you need to put it on the scope:
$scope.choice = “book1”
and you can not concat variables in object-calls.
you are trying to get “{listofbooks: { choice: […] }}” if you write this “listofbooks.choice[0].price”
This is the solution I was given on another forum but I can’t access choice from another controller, do you have any suggestions? (I tried changing $scope. to $rootScope but still no luck)