Angular JS search function on div not works


#1

Hi am trying to implement search functionality on a HTML page. Angular function works fine while i am running HTML code on chrome directly but same code not works when i am running the code by

ionic serve

Angular function for search functionality :

app.js :

var myApp = angular.module(‘myApp’, []);
myApp.controller(‘Ctrl1’, [’$scope’, function ($scope) {
$scope.onChangeText = function () {
var HtmlValue = document.getElementsByClassName(‘gettext’);
var Keytxt = document.getElementById(‘keyvalue’);
for (var i = 0; i < HtmlValue.length; i++)
{
var Values = HtmlValue[i].innerHTML;
if (Values.indexOf(Keytxt.value) !== -1)
{
document.getElementById(’’ + HtmlValue[i].id + ‘’).style.display = “block”;
}
else
{
document.getElementById(’’ + HtmlValue[i].id + ‘’).style.display = “none”;
}
}
}
$scope.chiliSpicy = function () {
$scope.spice = ‘chili’;
};

}]);