Last active
September 12, 2015 15:00
-
-
Save Epotignano/1f5cc14317ab6eee58b4 to your computer and use it in GitHub Desktop.
Using the array.some method for a filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.constant('geslachtOptions', [ | |
{'value': 'M', 'label': 'Man'}, | |
{'value' : 'V', 'label': 'Vrouw'}, | |
{'value': 'O', 'label': 'Onbekend'} | |
]) | |
.filter('geslachtFilter', function(geslachtOptions){ | |
return function(input) { | |
if(input) { | |
var ind; | |
geslachtOptions.some(function(option, index){ | |
ind = index; | |
return option.value == input | |
}); | |
return geslachtOptions[ind].label; | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment