Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Bug #105

Open
nasimmaleki opened this issue Jun 27, 2015 · 0 comments
Open

Fixing Bug #105

nasimmaleki opened this issue Jun 27, 2015 · 0 comments

Comments

@nasimmaleki
Copy link

hi, thanks for your useful lib.
I wanted to report you a bug. when I used your source I had a problem with the empty list and I got error from 'highlight' filter.Then I added a little change on the last if in your code.The new one is below :
app.filter('highlight', ['$sce', function ($sce) {
return function (input, searchParam) {
if (typeof input === 'function') return '';
if (searchParam) {
var words = '(' +
searchParam.split(/\ /).join(' |') + '|' +
searchParam.split(/\ /).join('|') +
')',
exp = new RegExp(words, 'gi');
if (words.length && input!=undefined) {
input = input.replace(exp, "<span class="highlight">$1");
}
}
return $sce.trustAsHtml(input);
};
}]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant