use angular.isDefined rather than typeof