batuman batuman - 6 months ago 55
AngularJS Question

Filter and search using AngularJS

I have code using AngularJS for search text.
But can't display rows in the table and search is not working well.

<html ng-app="myModule">
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="Scripts/angular.js" type="text/javascript"></script>
<script src="Scripts/Script.js" type="text/javascript"></script>
<link href="Styles.css" rel="stylesheet" type="text/css"/>
<div ng-controller="myController">
<input type="text" placeholder="Search name" ng-modle="" />
<input type="text" placeholder="Search city" ng-modle="" />
<input type="checkbox" ng-model="exactMatch" /> Exact match
<br /> <br />
<tr ng-repeat="employee in employees | filter:searchText:exactMatch">


var myApp = angular.module("myModule",[])
.controller("myController", function ($scope){
var employees = [
{name:"Ben", gender:"Male", salary:55500.00, city:"London"},
{name:"Thomas", gender:"Male", salary:56000.00, city:"Melbourne"},
{name:"Lin", gender:"Male", salary:78000.00, city:"Texas"},
{name:"Ben", gender:"Male", salary:85000.00, city:"Sydney"},
{name:"Ben", gender:"Male", salary:44000.00, city:"Singapore"}
$scope.employees = employees;

What are wrong?



You have a couple issues: 1) You've not included ng-app (in the jsfiddle) 2) You've misspelled ng-model in a couple places

Here is your code working on jsbin:,css,js,output