I'm new to AngularJS and am wondering how to bold statements that I'm searching for in the page. I'm using the filter method to filter a table, but I'd like to bold the filtered statements as well. For example, if I'm searching for
test
I'd like the following to be bolded:
this is a <b>test</b>
etc
Here's my controller code:
function PhoneListCtrl($scope, $http) {
$http.get('/text.json').success(function(data){
$scope.phones = data;
});
$scope.hello = "Hello, World";
$scope.orderProp = 'age';
$scope.query = "";
//$scope.query
$scope.smart_filter = function(item){
item = item.snippet;
var query_words = $scope.query.split(" ");
return query_words.every(function(word){return item.indexOf(word) != -1})
};
$scope.test = function(item){
return "<b>" + item + "</b>";
}