Replace undefined comparisons with angular.isDefined