I am trying to find whether the provided element is present in array or not using indexOf function.
But, I am not able to get whether true or false based on condition.
I am given the fiddle url .
Kindly, I need some assistance. http://jsfiddle.net/vMzSq/17/
<div ng-controller="MyCtrl">
Hello, {{name}}!<br>
Super? {{contains(name)}}
</div>
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.name = 'Sai';
$scope.searchNames = ['karthik','Sai']
$scope.contains = function(searchString) {
return searchString.indexOf(searchNames) != -1;
}