I have an app that shows a customers health history, where each insertion has an ID. Looks like this:
I have a search feature, where as you type, i would like the filter the display by the IDs
<input id="episode-id-input" placeholder="Search by episode ID..." type="text" class="validate" ng-model="vm.searchEpisodeById">
The way my data gets loaded is like this, through an ng-repeat:
<div ng-class="{
'kept' :person.pastAppointmentStatus == 'KEPT APPT.',
'cancelled':person.pastAppointmentStatus == 'CANCELLED',
}" class="past-appointments-meta-holder">
<div class="meta-holder-title">
<p class="meta-holder-title-name">
{{person.activeReferralsType}}
</p>
<p class="meta-holder-title-date">
{{person.activeReferralsDate| date:'MMMM dd, yyyy'}} | {{person.activeReferralsTime}}
</p>
<p class="meta-holder-title-status">
{{person.pastAppointmentStatus}}
</p>
<p class="episode-id">
EPISODE ID: {{person.episodeId}}
</p>
</div>
The Object looks like this:
, "historyContainer" : [
{
"activeReferralsType" : "new patient diabetic eye exam"
, "episodeId" : "9876"
, "activeReferralsDate" : new Date('1998-10-19')
, "activeReferralsTime" : "2:00PM"
, "referredFromName" : "Karen Rush, MD"
, "referredFromAddressFacilityName" : "Random Family Practice"
, "referredFromAddressFacilityAddressLineOne" : "1108 Cedar Road"
, "referredFromAddressFacilityAddressLineTwo" : "Chesapeake"
}
,{
"activeReferralsType" : "new patient diabetic eye exam"
, "episodeId" : "87678678"
, "activeReferralsDate" : new Date('1998-10-19')
, "activeReferralsTime" : "2:00PM"
, "referredFromName" : "Karen Rush, MD"
, "referredFromAddressFacilityName" : "Random Family Practice"
, "referredFromAddressFacilityAddressLineOne" : "1108 Cedar Road"
, "referredFromAddressFacilityAddressLineTwo" : "Chesapeake"
}
]
I have never used a filter function in angular before, could someone please show me how I would filter the ng-repeat after it has loaded, to show only the divs that have the ID typed in by the user?
