Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Filter an Array Based on User Input
WhatsApp
Ajay Malik
Aug 01
2016
741
0
1
<!DOCTYPE html
>
<
html
>
<
script
src
=
"http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"
>
</
script
>
<
body
>
<
div
ng-app
=
"myApp"
ng-controller
=
"namesCtrl"
>
<
p
>
Type a letter in the input field:
</
p
>
<
p
>
<
input
type
=
"text"
ng-model
=
"test"
>
</
p
>
<
ul
>
<
li
ng-repeat
=
"x in names | filter:test"
>
{{ x }}
</
li
>
</
ul
>
</
div
>
<
script
>
angular.module('myApp', []).controller('namesCtrl', function($scope) {
$
scope.names
= [
'c++',
'c#',
'c',
'.net',
'asp.net',
'mvc',
'AnjularJs',
'python',
'ruby'
];
});
</
script
>
<
p
>
The list will only consists of names matching the filter.
</
p
>
</
body
>
</
html
>
AngularJs
Up Next
Filter an Array Based on User Input