#84 empty arrays

Want to check if an array is empty in your templates, for example:

There are many ways to do this, one way would be check the array length e.g.

Or even better, you can use the empty computed helper in your controller to easily check if your comments array is empty with:

 


Also published on Medium.

Published by

Emad Ibrahim

Author of asp .net MVC & TDD, entrepreneur, passionate technologist, programmer and productivity nut. more at http://t.co/oSJXPvzu