Skip to content

Instantly share code, notes, and snippets.

@b4dnewz
Created July 12, 2017 11:57
Show Gist options
  • Save b4dnewz/bcd72adfd658529f978a4536901d2613 to your computer and use it in GitHub Desktop.
Save b4dnewz/bcd72adfd658529f978a4536901d2613 to your computer and use it in GitHub Desktop.
Angular filter to exclude items that belong to a given array.
'use strict'
###*
# @ngdoc filter
# @name app.filter:notInArray
# @description Angular filter to exclude items that belong to a given array.
# # notInArray
###
angular.module 'app'
.filter 'notInArray', ($filter) ->
(input, arr) ->
if angular.isUndefined(arr)
return input
$filter('filter')(input, (item) -> arr.indexOf(item) == -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment