-1

I am trying to fetch a value from one input field (which is a reference field) to filter some values in another drop down based on first input field in a same form in ng-admin.

I tried to use permanent filters to filter value, it works if i give a hard coded value. but i am not able to figure out how to get value of filter dynamically from above input field .

any help will be appreciated. I am new to angular and ng-admin and finding hard to solve this .

below is the code.

    nga.field('matchId', 'reference')
        .label('Match')
        .targetEntity(match)
        .targetField(nga.field('description'))
        .map(function(value) {
            if (!value) return '';
            return value.length > 20 ? value.substr(0, 20) + '...' :           value;
        }),

     nga.field('slotId', 'reference')
        .label('slot')
        .targetEntity(match_slot)
        .targetField(nga.field('matchSlotType')),

i want second field to be filtered based on input from first

1 Answers1

0

On angular filter docs you can see how they implement dynamic filtering:

<label>Any: <input ng-model="search.$"></label> <br>
<label>Name only <input ng-model="search.name"></label><br>
<label>Phone only <input ng-model="search.phone"></label><br>
<label>Equality <input type="checkbox" ng-model="strict"></label><br>
<table id="searchObjResults">
  <tr><th>Name</th><th>Phone</th></tr>
  <tr ng-repeat="friendObj in friends | filter:search:strict">
    <td>{{friendObj.name}}</td>
    <td>{{friendObj.phone}}</td>
  </tr>
</table>

Just put model name first parameter

Max
  • 1,824
  • 13
  • 22
  • thanks, but this is a angular way of doing it . is it a way to do in ng-admin itelf . i mean i know i can use permanent filters , but not able to figure out how to get value from first dropdown . – ashish kumar Jun 04 '16 at 09:55