The code probably works as is, but be careful here if what you really want is a real boolean value. As is right now, when books.has_books is false, your all_sections_have_choices variable would technically be 'undefined'.  Angular may be forgiving on this, though.