We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to highlight the searched text in the results?
The text was updated successfully, but these errors were encountered:
Hello @Disane87
you can use directive to achieve it;
directive: .filter('highlight', function($sce) { return function(text, phrase) { if (phrase) text = text.replace(new RegExp('('+phrase+')', 'gi'), '<span class="highlighted">$1</span>'); return $sce.trustAsHtml(text); }; })
.filter('highlight', function($sce) { return function(text, phrase) { if (phrase) text = text.replace(new RegExp('('+phrase+')', 'gi'), '<span class="highlighted">$1</span>'); return $sce.trustAsHtml(text); }; })
controller: $rootScope.cText = ''; var filterBarInstance; $scope.showFilterBar = function () { filterBarInstance = $ionicFilterBar.show({ items: $scope.fcontactsList, update: function (filteredItems, filterText) { $scope.fcontactsList = filteredItems; if (filterText) { console.log(filterText); $rootScope.cText = filterText; } } }); };
$rootScope.cText = ''; var filterBarInstance; $scope.showFilterBar = function () { filterBarInstance = $ionicFilterBar.show({ items: $scope.fcontactsList, update: function (filteredItems, filterText) { $scope.fcontactsList = filteredItems; if (filterText) { console.log(filterText); $rootScope.cText = filterText; } } }); };
html: <h2 ng-bind-html="client.accountName | highlight:cText" style="font-weight: 500">{{client.accountName}}</h2>
<h2 ng-bind-html="client.accountName | highlight:cText" style="font-weight: 500">{{client.accountName}}</h2>
css: .highlighted { color: rgba(216, 69, 59, 0.64); }
.highlighted { color: rgba(216, 69, 59, 0.64); }
Sorry, something went wrong.
No branches or pull requests
Is it possible to highlight the searched text in the results?
The text was updated successfully, but these errors were encountered: