Use angular.isUndefined instead of !angular.isDefined