Example: The picture-gallery-directive retrieves pictures and passes them to the scope:
var galleryBootstrapData = bootstrapDataService.get('galleryBootstrapData');
$scope.galleryPictures = galleryBootstrapData.pictures;
The picture-gallery-template renders the pictures and as shown below the number of pictures:
<div ng-if="galleryPictures.length && galleryPictures.length>0" >{{galleryPictures.length}}</div>
Is it good practice to check the scope-variables for undefined from within the template?
It isn't needed. Since so much of our data is handled asynchronously angular already recognizes this and will fail silently in the view when it encounters undefined variables
You could replace what you have with
Checking for
length > 0
isn't needed either since zero is falsy