using angular.isDefined for more precise undefined checks