2

I want to filter data on the basis of city dropdown alphabetical filter working fine but when i used dropdown and fiter dropdown selection then it will return wrong data please check my code here

[http://jsfiddle.net/Nayeem_Mansoori/yhy7hdrh/][1]

please help me.

2

2 Answers 2

1

When I want to filter one field only o do like it:

<li ng-repeat="cust in Customer | filter: { Name: myfilters } | orderBy: Name">{{cust.Name}}</li>

filter by properties use filter: { Name: myfilters }

http://jsfiddle.net/yhy7hdrh/4/

--- Some time later ---

I think I understand, chosing a city you want to filter by letter the Name of customer... http://jsfiddle.net/yhy7hdrh/8/

Sign up to request clarification or add additional context in comments.

7 Comments

please check jsfiddle.net/Nayeem_Mansoori/yhy7hdrh/2
its not working data not filter on the basis of city
Sorry, i did not understand
oh sorry, just trying to help
yes got it but when dropdown worked then alphanetical click not work so my question is both filter can't work paralally
|
0

I think u made a smallllll mistake :)

use like this

<li ng-repeat="cust in Customer | filter: myfilters | orderBy: 'Name'">{{cust.Name}}</li>

please put the Name as a string in orderBy as 'Name'

UPDATED FIDDLE

in order to filter by those two drop downs you need two separate filters, in angular its so simple as below line,

<li ng-repeat="cust in Customer | filter:selectedValue | filter:CityselectedValue | orderBy: 'Name'">

first it filter in selectedValue which is the first dropdown, and the second filter filters the results according to second dropdown.

UPDATED FIDDLE

more specifically use can use like this,

first dropdown

    <select ng-model="selectedValue.Name" n..

second dropdown

    <select ng-model="selectedValue.City" ng-opti..

in ng-repeat

<li ng-repeat="cust in Customer | filter:selectedValue | orderBy: 'Name'">

FIDDLE

2 Comments

ok, please select city dropdown afterthat click "A" or click "All" its not work
when dropdown worked then alphanetical click not work so my question is both filter can't work paralally

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.