Worked exactly as I needed! Thanks for the help!

On Friday, February 13, 2015 at 4:13:38 PM UTC-5, Victoria Mielke wrote:
>
> Hello, I am a total AngularJS noob and after reading several tutorials 
> decided to create a little "student app". Part of this app lists Academy 
> Award winners by year. It is supposed to little the category name, then the 
> nominees, with the winning nominee's name in bold. I am testing this with a 
> test JSON array that contains the Academy Award year, then a categories 
> array with each category name as an array of nominees:
> {
>     "year": "2011",
>     "categories": {
>         "Actor": [{
>             "nominee": "Jean DuJardin",
>             "movie": "The Artist",
>             "won": "yes"
>         },
>         {
>             "nominee": "Demian Bechir",
>             "movie": "A Better Life",
>             "won": "no"
>         },
>         {
>             "nominee": "George Clooney",
>             "movie": "The Descendants",
>             "won": "no"
>         },
>         {
>             "nominee": "Gary Oldman",
>             "movie": "Tinker Tailor Soldier Spy",
>             "won": "no"
>         },
>         {
>             "nominee": "Brad Pitt",
>             "movie": "Moneyball",
>             "won": "no"
>         }],
>         "Supporting Actor": [{
>             "nominee": "Christopher Plummer",
>             "movie": "Beginners",
>             "won": "yes"
>         },
>         {
>             "nominee": "Kenneth Branagh",
>             "movie": "My Week With Marilyn",
>             "won": "no"
>         },
>         {
>             "nominee": "Jonah Hill",
>             "movie": "Moneyball",
>             "won": "no"
>         },
>         {
>             "nominee": "Nick Nolte",
>             "movie": "Warrior (Paddy Conlon)",
>             "won": "no"
>         },
>         {
>             "nominee": "Max von Sydow",
>             "movie": "Extremely Loud & Incredibly Close",
>             "won": "no"
>         }]
>     }
> }
>
> I created an oscars list controller, which is extremely basic. Right now 
> it just fetches the JSON file above.
> movieDataApp.controller('oscarController', ['$scope', '$http',
>    function($scope, $http) {
>    
>    $http.get("js/oscartest-short.json").success(function(data) {
>       $scope.oscars = data;
>          
>    });
>    
> }]);
>
> And this is the oscars.html page. I can get the nominees and their movies 
> to display properly, but I am totally stumped on how to display category 
> names, such as Actor or Supporting Actor, as this loops through the arrays.
>
> <h1>Oscar Data Page</h1>
>     <h4>{{oscars.year}}</h4>
>     <p>Winner is in bold.</p>
>     <div ng-repeat="category in oscars.categories">
>         {{oscars.category}}
>         <ul ng-repeat="item in category">
>             <li ng-if="item.won === 'yes'">
>                 <strong>{{item.nominee}}, <em>{{item.movie}}</em></strong>
>             </li>
>             <li ng-if="item.won === 'no'">
>                 {{item.nominee}}, <em>{{item.movie}}</em>
>             </li>
>         </ul>
>     </div>
>
>
> What is the correct nomenclature for the category? I tried 
> oscars.category.categories, categories.category and category.name, and 
> nothing worked. Any help is greatly appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to