function _findIndex(haystack, needle) {
            if (angular.isUndefined(haystack) || haystack.length === 0) {
                return -1;
            }

            for (var i = 0, len = haystack.length; i < len; i++) {
                if (haystack[i] === needle) {
                    return i;
                }
            }

            return -1;
        }
Find the index of an element in an array.

@param  {Array}  haystack The array in which to search for the value.
@param  {*}      needle   The value to search in the array.
@return {number} The index of the value of the array, or -1 if not found.